You are here

protected function EntityReferenceHandlerBase::shouldEmbedReferencedEntities 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::shouldEmbedReferencedEntities()
  2. 2.0.x src/Plugin/EntityReferenceHandlerBase.php \Drupal\cms_content_sync\Plugin\EntityReferenceHandlerBase::shouldEmbedReferencedEntities()

Check if referenced entities should be embedded automatically.

Parameters

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

Return value

bool

4 calls to EntityReferenceHandlerBase::shouldEmbedReferencedEntities()
DefaultWebformHandler::serializeReference in src/Plugin/cms_content_sync/field_handler/DefaultWebformHandler.php
EntityReferenceHandlerBase::serializeReference in src/Plugin/EntityReferenceHandlerBase.php
EntityReferenceHandlerBase::setValues 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 286

Class

EntityReferenceHandlerBase
Providing a base implementation for any reference field type.

Namespace

Drupal\cms_content_sync\Plugin

Code

protected function shouldEmbedReferencedEntities($default = false) {
  if ($this
    ->forceEmbeddingReferencedEntities()) {
    return true;
  }
  if (isset($this->settings['handler_settings']['embed_referenced_entities'])) {
    return (bool) $this->settings['handler_settings']['embed_referenced_entities'];
  }
  if ($default) {
    return true;
  }
  return false;
}