Entity Share V3: Perspectives of the new architecture

  • 199
  • 14
  • 10 Aug 2020

Starting point

 

What is Entity Share?

 

Entity Share is a collection of modules allowing you to share content like articles or media between different Drupal instances.

 

Its development has started at the beginning of 2017 to answer the problem of deploying content in webfactory type projects we had for our clients.

 

At that moment, the state of art was not satisfying enough to correctly answer our needs.

 

How does Entity Share work?

 

In short, when you have at least two websites:

 

You configure one to be a content server with the Entity Share Server sub-module. On this website, you configure “channels” which allows you to expose which content types(, media types, etc.) in which languages are available for sharing.

 

You configure the other website to be a client with the Entity Share Client sub-module. On this website, you enter the URL and authentication information to the other website. Then you have access to a “Pull form” allowing you to select which content you want to import.

 

Other presentations to go deeper

 

For more details about the current version (8.x-2.0-alpha11) of Entity Share, you can take a look at the presentations we have done before:

 

You can also take a look at this very well detailed article: Entity Share - A cost-effective solution to manage multisite content.

 

To go beyond this article, which is focused on the current version, this article will present the new version in development.

 

Limitations

 

Currently, on the client site, when you want to pull content, you have to:

  • select the website you want to pull content from (auto selected if only one website is available),
  • select one of the available channels (auto selected if only one channel is available),
  • select the contents you want to import.

 

Then all the import processing is done, and there is no way to configure that using the back-office (there are partial ways for developers using events). The import processing consists of creating or updating an entity, then recursively import all the referenced entities and import the physical files.

 

For example, you can’t limit the recursion depth when referenced entities are imported. So depending on your website topology, if you have a lot of crossed-linked contents, importing one content can result in a ton of contents imported by recursion.

 

With the feedbacks accumulated on our client projects or by other Drupal community actors, the Entity Share’s issue queue has been filled with a lot of feature requests to handle more and more advanced usages.

 

Which is great! This means that the Entity Share module is more and more used and answers a recurring need!

 

But the current architecture is not ready to answer those features requests in a proper manner and not ready to allow developers to customize Entity Share properly for their projects. So it is time for a rework of the module’s architecture.

 

The new architecture

 

To ease maintenance, customization and to allow fine grained configuration, we introduced a dedicated plugin type and clearly defined steps in the import process, so that each plugin could react at any of these steps.

 

This is inspired by both code and ideas from the Search API module in which you can configure processors that can act on the way your data is indexed, queried, displayed, etc. with your search indexes.

 

Manage processor for search index content

When released, we will have a dedicated configuration entity, the “Import config” entity type, which stores:

  • which plugins is enabled or not,
  • the configuration of each plugin: for example, the depth of recursion of entity reference import,
  • the weight of each enabled plugin in each import steps: so you can have a total control on the order of execution of the import processing.

Add config import

With this new architecture, the steps to import entities are:

  • select one of the available import configurations (auto selected if only one import config is available),
  • select the website you want to pull content from (auto selected if only one website is available),
  • select one of the available channels (auto selected if only one channel is available),
  • select the contents you want to import.

 

Yes, this adds an extra step, but this extra step allows your import to behave differently depending on your needs.

Pull entities

For example, if there is a plugin to automatically import entities referenced in link fields (see this issue), there is no need to have it enabled if you don’t want or need it. Whereas with the previous architecture, such a feature would have been enabled by default on all imports. And so with each feature request implemented, this would have caused a lot of unnecessary processing depending on your needs.

 

Benefits for developers (DX)

 

With this new plugin system, developers:

  • are able to alter the import processing from code inside dedicated classes, no more need to patch Entity Share,
  • have more entry points to alter the import processing at the right time for their need,
  • can fully override or disable common behavior provided by the Entity Share module and sub-modules.

 

The main import process code had been revamped into new services, with clear interfaces to remove duplicated code and to ease the development of custom code.

 

For example, the new “ImportService” service allows to import specific entities from a channel or a whole channel using the “importEntities” or the “importChannel” methods. These methods had been thought to be used by providing only the strict minimum of arguments to ease the usage.

 

Also the command line integration will be revamped to benefit from the “import config” and therefore to have the same features and behavior if the import is launched from the command line or from the Drupal BO.

 

Benefits for administrators (UX)

 

With this new plugin system, administrators:

  • can have different import behaviors and select the one they want for their import,
  • are able to control with a fine grained granularity how they want their import to behave.

 

This rework is also the opportunity to improve all parts of the module and for example:

  • now administrators are able to import a whole channel using the “Pull form”, whereas it was only possible using the command line before,
  • some inconsistent behavior when indicating if an imported content is not synchronized will be fixed.

 

Conclusion and roadmap

 

After 3 years of existence, with more and more feedback and feature requests accumulated, it was time to rethink the module’s architecture to be prepared for future evolutions.

 

The new architecture empowers both developers, administrators and eases the module’s maintenance.

 

For a detailed and up-to-date roadmap, you can take a look at the following issue: https://www.drupal.org/project/entity_share/issues/3082611

 

Help is always welcomed, you can provide feedback and patches in the issue queue. And if you want to sponsor the module maintenance or some specific features, or if you need dedicated support time, get in touch with us!

Comments on "Entity Share V3: Perspectives of the new architecture"

These are truly fantastic ideas in about blogging. You have touched some fastidious factors here.
Any way keep up wrinting. Amazing! This blog looks just like my old one!

It's on a completely different topic but it has pretty much the same page layout and
design. Great choice of colors! Does your website have
a contact page? I'm having trouble locating it but, I'd like to shoot you an email.
I've got some ideas for your blog you might be interested in hearing.
Either way, great site and I look forward to seeing it
grow over time. http://Vans.com/

menqOJudRYDCZUrK

LdtUXfwIArm

PYWmjgQUu

kiGaKWSzUO

Thanks for writing this wonderful presentation, It helps a lot, import config process feature is really amazing and helpful, However I am looking more contents in authentication plugins and client authorization mechanism. It will be helpful if you could add that.

HgLbFnANIW

jEVlwCPcrX

IjQVymHDUhsp

qrGsCDEMP

chkDZdUqbi

aZXSUIjkMBQNuosv

ievaRgKJthUB

ywQETsUjJnNS

Leave a comment

* Required fields

Comments are subject to validation.

The collection of the requested information is necessary for the processing of your application by SMILE, controller. This collected information may be used for prospecting purposes. You have a right to access, rectify, oppose and delete data concerning you. To exercise them, simply contact us by email at the following address marketing@smile.fr or by post to the attention of SMILE - 20 rue des Jardins 92600 Asnieres sur Seine. We invite you to read our data protection policy.

Open source training

Durée : 2 jours
Lieu : Paris