Entity Share is an all in one module allowing you to share some entities like node, field collection, taxonomy, medias etc between different Drupal instances.

Drupal 8

This module allows to share entities using the JSON API. It provides an UI to use the endpoints provided by the JSON API module.

You can define one website as a "server" and another website as a "client".

Currently you can only, on the client website, get content exposed from the server website. You can't push content from the client website to the server website.

When pulling content, referenced entities are also pulled recursively. If you reselect a content it will be updated and referenced entities will also be updated recursively.

The entities you want to share must have the same structure (machine name, field machine name and storage) across the different websites.

Note about links and embed entities in RTE:

To ensure the share of links referencing entities (most of the time content) and
entities that are embedded in RTE, we recommend to use the following modules, as
they use UUID to operate:

This module does nothing to ensure the embed entities are shared automatically,
you must share the entities by yourself.

Note about multilingual content:

When pulling translatable content, the default langcode is dropped to avoid to have to pull the content in its original language and because the original language may be not enabled on the client website.

Referenced entities will be imported in the same language as the referencing entity if possible. If a referenced entity is not available in the same language, Drupal will display the entity in the first language available depending of the languages weight.

Note about CRON usage:

If you want to synchronize entities automatically using CRON, there is a test module 'entity_share_client_test' that provides example code.

Limitation:

Currently we do not handle config entities and user entities to avoid side effects.

Requirements

This module requires the following modules:

Recommended modules

Installation

  • Install and enable the Entity share server on the site you want to get content from.
  • Install and enable the Entity share client on the site you want to put content on.

Configuration

On the server website:

  • Enable the Entity share server module.
  • Optional: Prepare an user with the permission "Access channels list" if you do not want to use the admin user.
  • Go to the configuration page, Configuration > Web services > Entity share > Channels (admin/config/services/entity_share/channel) and add at least one channel.

On the client website:

  • Enable the Entity share client module.
  • Go to the configuration page, Configuration > Web services > Entity share > Remote websites (admin/config/services/entity_share/remote) and create a remote website corresponding to your server website with the user name and password configured on the server website.
  • Go to the pull form, Content > Entity share > Pull entities (admin/content/entity_share/pull), and select your remote website, the available channels will be listed and when selecting a channel, the entities exposed on this channel will be available to synchronize.

Troubleshooting

  • To handle taxonomy hierarchy, a patch on Drupal core is required: #2543726-96: [PP-1] Make $term->parent behave like any other entity reference field
  • As Drupal stores the id of entities for internal link fields that reference entities, we need Drupal to store the value of these fields using UUID. There is an issue for that #2873068: Link field with internal entity.
    As a workaround, it is possible to use the JSON API Extras module to alter the data for link fields. It requires the following patch to be applied #2883437-3: Transform link field value to use UUID to add a field enhancer.
    Then for the concerned JSON API endpoints, you can use the field enhancer on the link fields.
    Note 1: This configuration must be applied and identical on both websites (server and client).
    Note 2: If the target entity of a link field value has not been imported yet, the value of the link field will be unset. So an update will be required to update the link field value.

Drupal 7

How does it work ?

The principle of this module is to generate some export from one instance and to send this exported datas to a remote Drupal using a server that will import the datas.

The limitation is that you MUST have exactly the same content types, field_collections, taxonomy vocabularies between all your instances. This module manage the export of contents, not of structures (you can use features module to synchronise your structure for example).

You can just use the module for its Export and Import Entity API.

Features

  • Import/Export Entities
  • Scald Atoms
    • Atom reference
    • Embedded Atoms in RTE
  • Field Collection
  • Taxonomy terms
  • Files
  • Entity Reference (coming soon)
  • Extendable to implement new field type

Compatibility

Requires PHP 5.3+

Depends on

Maintainers

Supporting organizations: 
sponsors development

Project Information

Downloads