You are here

function hook_acquia_contenthub_is_eligible_entity in Acquia Content Hub 8

Determines whether an entity is eligible to be published to Content Hub.

Modules may implement this hook to determine whether a particular entity can be exported to Content Hub on a custom logic. Content Hub checks for entities that are published and selected in the entity configuration page but additional logic can be added through this hook.

For example only nodes promoted to the frontpage can be published to Content Hub according to the following code.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity to check for eligibility.

Return value

bool TRUE if it is eligible to be published, FALSE otherwise.

1 invocation of hook_acquia_contenthub_is_eligible_entity()
EntityManager::isEligibleEntity in src/EntityManager.php
Checks whether the current entity should be transferred to Content Hub.

File

./acquia_contenthub.api.php, line 275
Hooks provided by the Acquia Content Hub module.

Code

function hook_acquia_contenthub_is_eligible_entity(EntityInterface $entity) {
  if ($entity
    ->getEntityTypeId() === 'node') {
    return $entity
      ->isPromoted();
  }
}