You are here

protected function EntityReferenceHandlerBase::shouldPushReferencedEntities in CMS Content Sync 8

Same name and namespace in other branches
  1. 2.1.x src/Plugin/EntityReferenceHandlerBase.php \Drupal\cms_content_sync\Plugin\EntityReferenceHandlerBase::shouldPushReferencedEntities()
  2. 2.0.x src/Plugin/EntityReferenceHandlerBase.php \Drupal\cms_content_sync\Plugin\EntityReferenceHandlerBase::shouldPushReferencedEntities()

Check if referenced entities should be pushed automatically.

Parameters

bool $default: Whether to get the default value (TRUE) if none is set yet

Return value

bool

4 calls to EntityReferenceHandlerBase::shouldPushReferencedEntities()
DefaultWebformHandler::serializeReference in src/Plugin/cms_content_sync/field_handler/DefaultWebformHandler.php
EntityReferenceHandlerBase::getHandlerSettings in src/Plugin/EntityReferenceHandlerBase.php
Get the handler settings.
EntityReferenceHandlerBase::serializeReference in src/Plugin/EntityReferenceHandlerBase.php
EntityReferenceHandlerBase::validateHandlerSettings in src/Plugin/EntityReferenceHandlerBase.php
Validate the settings defined above. $form and $form_state are the same as in the Form API. $settings_key is the index at $form['sync_entities'] for this handler instance.

File

src/Plugin/EntityReferenceHandlerBase.php, line 312

Class

EntityReferenceHandlerBase
Providing a base implementation for any reference field type.

Namespace

Drupal\cms_content_sync\Plugin

Code

protected function shouldPushReferencedEntities($default = false) {

  // Not syndicating views.
  $getReferencedEntityTypes = $this
    ->getReferencedEntityTypes();
  if (in_array('view', $getReferencedEntityTypes)) {
    return false;
  }
  if ($this
    ->forcePushingReferencedEntities()) {
    return true;
  }
  if (isset($this->settings['handler_settings']['export_referenced_entities'])) {
    return (bool) $this->settings['handler_settings']['export_referenced_entities'];
  }
  if ($default) {
    return true;
  }
  return false;
}