You are here

function cms_content_sync_entity_insert in CMS Content Sync 2.1.x

Same name and namespace in other branches
  1. 8 cms_content_sync.module \cms_content_sync_entity_insert()
  2. 2.0.x cms_content_sync.module \cms_content_sync_entity_insert()

Push the entity automatically if configured to do so.

Parameters

\Drupal\Core\Entity\EntityInterface $entity:

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

File

./cms_content_sync.module, line 1092
Module file for cms_content_sync.

Code

function cms_content_sync_entity_insert(EntityInterface $entity) {
  if (!_cms_content_sync_is_installed()) {
    return;
  }
  if (!EntityHandlerPluginManager::isSupported($entity
    ->getEntityTypeId(), $entity
    ->bundle())) {
    return;
  }
  if ($entity instanceof FieldableEntityInterface) {
    DefaultEntityReferenceHandler::saveEmbeddedPushToPools($entity);
  }
  PushIntent::pushEntityFromUi($entity, PushIntent::PUSH_AUTOMATICALLY, SyncIntent::ACTION_CREATE);
}