Content Hub

Developing with Content Hub

Important

Content Hub 2.x will reach end-of-life on December 31, 2024. Acquia recommends that you update your Content Hub version to Content Hub 3.x by using the composer require instructions available on the acquia_contenthub project page.

Content Hub 2.x is a departure from previous versions of Content Hub, and contains several new capabilities. To begin developing with Content Hub 2.x, it can be helpful to understand the differences between these two versions.

Understanding Dependency Calculation

Before attempting to syndicate your data, you must understand your data’s underlying structure. To examine the data objects in your Drupal-based website, including their connections and how they are related to one another, install the Dependency Calculation module.

The Dependency Calculation module performs the following actions:

  • Pass an entity to all subscribers which receive that entity.
  • Allow all subscribers to extract, change, or relate data to that entity.
  • Re-run dependency calculations against any new dependencies the subscribers may have added to the entity.

In Drupal, non-standard relationships are relationships between entities that are not represented by standard relationship models, such as an entity reference field. If your website creates non-standard relationships between two entities or entity types, you must define a dependency calculation event subscriber to inform Drupal of the relationship, which enables the relationship to be syndicated from the publishing website to the subscribing websites.

For example, websites that embed entities into text areas using a module (such as the Entity Embed module) frequently require additional media entities for proper syndication of the original entity and its embedded content. For successful syndication in Content Hub, this dependency must be declared in a dependency calculation event.

Understanding Serialization and Replication

Although serialization processes (such as REST) are commonly used to send data from one website to another website, using these processes may not be the correct approach. Examples of issues that may occur include the following:

  • Drupal’s REST resources produce entities that are not syndicated when unpublished translations are edited, resulting in data loss on subscribing websites. This happens when REST performs an entity access check and misinterprets the edit actions as a complete removal of data.
  • Drupal uses field-level access permissions to prevent users from viewing certain fields, but syndicating the entities without including those hidden fields results in data loss.

To resolve issues that may arise (including the previously described problems), Content Hub 2.x focuses on replication, and not serialization. Instead of using Drupal’s normal serialization processes, Content Hub depends on a small set of field- and entity-level interpreters that can serialize and unserialize field-level data in safe, multilingual formats, which can be converted into normal entity data during import.

Using relationships

Custom entity types can work well with Content Hub, assuming that non-standard relationships define their dependency calculation event subscribers.

When creating custom field types, evaluate the handlers in place for serializing and deserializing your field’s data. Content Hub provides some classes which will attempt to determine how to handle your field’s data, but you can also develop your own classes to define how to properly handle your data.

Did not find what you were looking for?

If this content did not answer your questions, try searching or contacting our support team for further assistance.

Acquia Help

Filter by product:

Content Hub common questions