本文整理汇总了PHP中Drupal\Core\Entity\ContentEntityInterface::getEntityTypeId方法的典型用法代码示例。如果您正苦于以下问题:PHP ContentEntityInterface::getEntityTypeId方法的具体用法?PHP ContentEntityInterface::getEntityTypeId怎么用?PHP ContentEntityInterface::getEntityTypeId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\Core\Entity\ContentEntityInterface
的用法示例。
在下文中一共展示了ContentEntityInterface::getEntityTypeId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: collectRenderDisplay
/**
* Returns the entity_form_display object used to build an entity form.
*
* Depending on the configuration of the form mode for the entity bundle, this
* can be either the display object associated to the form mode, or the
* 'default' display.
*
* This method should only be used internally when rendering an entity form.
* When assigning suggested display options for a component in a given form
* mode, entity_get_form_display() should be used instead, in order to avoid
* inadvertently modifying the output of other form modes that might happen to
* use the 'default' display too. Those options will then be effectively
* applied only if the form mode is configured to use them.
*
* hook_entity_form_display_alter() is invoked on each display, allowing 3rd
* party code to alter the display options held in the display before they are
* used to generate render arrays.
*
* @param \Drupal\Core\Entity\ContentEntityInterface $entity
* The entity for which the form is being built.
* @param string $form_mode
* The form mode.
*
* @return \Drupal\Core\Entity\Display\EntityFormDisplayInterface
* The display object that should be used to build the entity form.
*
* @see entity_get_form_display()
* @see hook_entity_form_display_alter()
*/
public static function collectRenderDisplay(ContentEntityInterface $entity, $form_mode)
{
$entity_type = $entity->getEntityTypeId();
$bundle = $entity->bundle();
// Check the existence and status of:
// - the display for the form mode,
// - the 'default' display.
if ($form_mode != 'default') {
$candidate_ids[] = $entity_type . '.' . $bundle . '.' . $form_mode;
}
$candidate_ids[] = $entity_type . '.' . $bundle . '.default';
$results = \Drupal::entityQuery('entity_form_display')->condition('id', $candidate_ids)->condition('status', TRUE)->execute();
// Load the first valid candidate display, if any.
$storage = \Drupal::entityManager()->getStorage('entity_form_display');
foreach ($candidate_ids as $candidate_id) {
if (isset($results[$candidate_id])) {
$display = $storage->load($candidate_id);
break;
}
}
// Else create a fresh runtime object.
if (empty($display)) {
$display = $storage->create(array('targetEntityType' => $entity_type, 'bundle' => $bundle, 'mode' => $form_mode, 'status' => TRUE));
}
// Let the display know which form mode was originally requested.
$display->originalMode = $form_mode;
// Let modules alter the display.
$display_context = array('entity_type' => $entity_type, 'bundle' => $bundle, 'form_mode' => $form_mode);
\Drupal::moduleHandler()->alter('entity_form_display', $display, $display_context);
return $display;
}
示例2: checkAccess
protected function checkAccess(ContentEntityInterface $entity, AccountInterface $account, $operation = 'view')
{
$entity_type = $entity->getEntityType();
$entity_type_id = $entity->getEntityTypeId();
$entity_access = $this->entityTypeManager->getAccessControlHandler($entity_type_id);
/** @var \Drupal\Core\Entity\EntityStorageInterface $entity_storage */
$entity_storage = $this->entityTypeManager->getStorage($entity_type_id);
$map = ['view' => "view all {$entity_type_id} revisions", 'list' => "view all {$entity_type_id} revisions", 'update' => "revert all {$entity_type_id} revisions", 'delete' => "delete all {$entity_type_id} revisions"];
$bundle = $entity->bundle();
$type_map = ['view' => "view {$entity_type_id} {$bundle} revisions", 'list' => "view {$entity_type_id} {$bundle} revisions", 'update' => "revert {$entity_type_id} {$bundle} revisions", 'delete' => "delete {$entity_type_id} {$bundle} revisions"];
if (!$entity || !isset($map[$operation]) || !isset($type_map[$operation])) {
// If there was no node to check against, or the $op was not one of the
// supported ones, we return access denied.
return FALSE;
}
// Statically cache access by revision ID, language code, user account ID,
// and operation.
$langcode = $entity->language()->getId();
$cid = $entity->getRevisionId() . ':' . $langcode . ':' . $account->id() . ':' . $operation;
if (!isset($this->accessCache[$cid])) {
// Perform basic permission checks first.
if (!$account->hasPermission($map[$operation]) && !$account->hasPermission($type_map[$operation]) && !$account->hasPermission('administer nodes')) {
$this->accessCache[$cid] = FALSE;
return FALSE;
}
if (($admin_permission = $entity_type->getAdminPermission()) && $account->hasPermission($admin_permission)) {
$this->accessCache[$cid] = TRUE;
} else {
// First check the access to the default revision and finally, if the
// node passed in is not the default revision then access to that, too.
$this->accessCache[$cid] = $entity_access->access($entity_storage->load($entity->id()), $operation, $account) && ($entity->isDefaultRevision() || $entity_access->access($entity, $operation, $account));
}
}
return $this->accessCache[$cid];
}
示例3: submitForm
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state)
{
$this->entityManager->getStorage($this->entityRevision->getEntityTypeId())->deleteRevision($this->entityRevision->getRevisionId());
$this->logger('content')->notice('@type: deleted %title revision %revision.', ['@type' => $this->entityRevision->bundle(), '%title' => $this->entityRevision->label(), '%revision' => $this->entityRevision->getRevisionId()]);
drupal_set_message(t('@type %title has been deleted', ['@type' => $this->entityRevision->{$this->entityRevision->getEntityType()->getKey('bundle')}->entity->label(), '%title' => $this->entityRevision->label()]));
$form_state->setRedirectUrl($this->entityRevision->urlInfo('version-history'));
}
示例4: getAddLink
protected function getAddLink(ContentEntityInterface $host)
{
$link = '';
if ($host->access('update', \Drupal::currentUser())) {
$link = '<ul class="action-links action-links-field-collection-add"><li>';
$link .= \Drupal::l(t('Add'), Url::FromRoute('field_collection_item.add_page', ['field_collection' => $this->fieldDefinition->getName(), 'host_type' => $host->getEntityTypeId(), 'host_id' => $host->id()]));
$link .= '</li></ul>';
}
return $link;
}
示例5: synchronizeFields
/**
* {@inheritdoc}
*/
public function synchronizeFields(ContentEntityInterface $entity, $sync_langcode, $original_langcode = NULL)
{
$translations = $entity->getTranslationLanguages();
$field_type_manager = \Drupal::service('plugin.manager.field.field_type');
// If we have no information about what to sync to, if we are creating a new
// entity, if we have no translations for the current entity and we are not
// creating one, then there is nothing to synchronize.
if (empty($sync_langcode) || $entity->isNew() || count($translations) < 2) {
return;
}
// If the entity language is being changed there is nothing to synchronize.
$entity_type = $entity->getEntityTypeId();
$entity_unchanged = isset($entity->original) ? $entity->original : $this->entityManager->getStorage($entity_type)->loadUnchanged($entity->id());
if ($entity->getUntranslated()->language()->getId() != $entity_unchanged->getUntranslated()->language()->getId()) {
return;
}
/** @var \Drupal\Core\Field\FieldItemListInterface $items */
foreach ($entity as $field_name => $items) {
$field_definition = $items->getFieldDefinition();
$field_type_definition = $field_type_manager->getDefinition($field_definition->getType());
$column_groups = $field_type_definition['column_groups'];
// Sync if the field is translatable, not empty, and the synchronization
// setting is enabled.
if ($field_definition instanceof ThirdPartySettingsInterface && $field_definition->isTranslatable() && !$items->isEmpty() && ($translation_sync = $field_definition->getThirdPartySetting('content_translation', 'translation_sync'))) {
// Retrieve all the untranslatable column groups and merge them into
// single list.
$groups = array_keys(array_diff($translation_sync, array_filter($translation_sync)));
if (!empty($groups)) {
$columns = array();
foreach ($groups as $group) {
$info = $column_groups[$group];
// A missing 'columns' key indicates we have a single-column group.
$columns = array_merge($columns, isset($info['columns']) ? $info['columns'] : array($group));
}
if (!empty($columns)) {
$values = array();
foreach ($translations as $langcode => $language) {
$values[$langcode] = $entity->getTranslation($langcode)->get($field_name)->getValue();
}
// If a translation is being created, the original values should be
// used as the unchanged items. In fact there are no unchanged items
// to check against.
$langcode = $original_langcode ?: $sync_langcode;
$unchanged_items = $entity_unchanged->getTranslation($langcode)->get($field_name)->getValue();
$this->synchronizeItems($values, $unchanged_items, $sync_langcode, array_keys($translations), $columns);
foreach ($translations as $langcode => $language) {
$entity->getTranslation($langcode)->get($field_name)->setValue($values[$langcode]);
}
}
}
}
}
}
示例6: checkAccess
protected function checkAccess(ContentEntityInterface $entity, AccountInterface $account, $operation = 'view')
{
$entity_type_id = $entity->getEntityTypeId();
$entity_access = $this->entityManager->getAccessControlHandler($entity_type_id);
/** @var \Drupal\content_entity_base\Entity\Storage\RevisionableStorageInterface|\Drupal\Core\Entity\EntityStorageInterface $entity_storage */
$entity_storage = $this->entityManager->getStorage($entity_type_id);
if (!$entity_storage instanceof RevisionableStorageInterface) {
throw new \InvalidArgumentException('The entity storage has to implement \\Drupal\\content_entity_base\\Entity\\Storage\\RevisionableStorageInterface');
}
$map = ['view' => "view all {$entity_type_id} revisions", 'update' => "revert all {$entity_type_id} revisions", 'delete' => "delete all {$entity_type_id} revisions"];
$bundle = $entity->bundle();
$type_map = ['view' => "view {$entity_type_id} {$bundle} revisions", 'update' => "revert {$entity_type_id} {$bundle} revisions", 'delete' => "delete {$entity_type_id} {$bundle} revisions"];
if (!$entity || !isset($map[$operation]) || !isset($type_map[$operation])) {
// If there was no node to check against, or the $op was not one of the
// supported ones, we return access denied.
return FALSE;
}
// Statically cache access by revision ID, language code, user account ID,
// and operation.
$langcode = $entity->language()->getId();
$cid = $entity->getRevisionId() . ':' . $langcode . ':' . $account->id() . ':' . $operation;
if (!isset($this->access[$cid])) {
// Perform basic permission checks first.
if (!$account->hasPermission($map[$operation]) && !$account->hasPermission($type_map[$operation]) && !$account->hasPermission('administer nodes')) {
$this->access[$cid] = FALSE;
return FALSE;
}
// There should be at least two revisions. If the vid of the given node
// and the vid of the default revision differ, then we already have two
// different revisions so there is no need for a separate database check.
// Also, if you try to revert to or delete the default revision, that's
// not good.
if ($entity->isDefaultRevision() && ($entity_storage->countDefaultLanguageRevisions($entity) == 1 || $operation == 'update' || $operation == 'delete')) {
$this->access[$cid] = FALSE;
} elseif ($account->hasPermission('administer ' . $entity_type_id)) {
$this->access[$cid] = TRUE;
} else {
// First check the access to the default revision and finally, if the
// node passed in is not the default revision then access to that, too.
$this->access[$cid] = $entity_access->access($entity_storage->load($entity->id()), $operation, $account) && ($entity->isDefaultRevision() || $entity_access->access($entity, $operation, $account));
}
}
return $this->access[$cid];
}
示例7: assertFieldStorageLangcode
/**
* Checks whether field languages are correctly stored for the given entity.
*
* @param \Drupal\Core\Entity\ContentEntityInterface $entity
* The entity fields are attached to.
* @param string $message
* (optional) A message to display with the assertion.
*/
protected function assertFieldStorageLangcode(ContentEntityInterface $entity, $message = '')
{
$status = TRUE;
$entity_type = $entity->getEntityTypeId();
$id = $entity->id();
$langcode = $entity->getUntranslated()->language()->id;
$fields = array($this->field_name, $this->untranslatable_field_name);
foreach ($fields as $field_name) {
$field_storage = FieldStorageConfig::loadByName($entity_type, $field_name);
$tables = array(ContentEntityDatabaseStorage::_fieldTableName($field_storage), ContentEntityDatabaseStorage::_fieldRevisionTableName($field_storage));
foreach ($tables as $table) {
$record = \Drupal::database()->select($table, 'f')->fields('f')->condition('f.entity_id', $id)->condition('f.revision_id', $id)->execute()->fetchObject();
if ($record->langcode != $langcode) {
$status = FALSE;
break;
}
}
}
return $this->assertTrue($status, $message);
}
示例8: parseEntity
/**
* Transforms an entity into an array of strings.
*
* Parses an entity's fields and for every field it builds an array of string
* to be compared. Basically this function transforms an entity into an array
* of strings.
*
* @param ContentEntityInterface $entity
* An entity containing fields.
*
* @return array
* Array of strings resulted by parsing the entity.
*/
public function parseEntity(ContentEntityInterface $entity)
{
$result = array();
$entity_type_id = $entity->getEntityTypeId();
// Load all entity base fields.
$entity_base_fields = $this->entityManager->getBaseFieldDefinitions($entity_type_id);
// Loop through entity fields and transform every FieldItemList object
// into an array of strings according to field type specific settings.
foreach ($entity as $field_items) {
$field_type = $field_items->getFieldDefinition()->getType();
$plugin_config = $this->pluginsConfig->get('field_types.' . $field_type);
$plugin = NULL;
if ($plugin_config && $plugin_config['type'] != 'hidden') {
$plugin = $this->diffBuilderManager->createInstance($plugin_config['type'], $plugin_config['settings']);
}
if ($plugin) {
// Configurable field. It is the responsibility of the class extending
// this class to hide some configurable fields from comparison. This
// class compares all configurable fields.
if (!array_key_exists($field_items->getName(), $entity_base_fields)) {
$build = $plugin->build($field_items);
if (!empty($build)) {
$result[$field_items->getName()] = $build;
}
} else {
// Check if this field needs to be compared.
$config_key = 'entity.' . $entity_type_id . '.' . $field_items->getName();
$enabled = $this->config->get($config_key);
if ($enabled) {
$build = $plugin->build($field_items);
if (!empty($build)) {
$result[$field_items->getName()] = $build;
}
}
}
}
}
return $result;
}
示例9: buildBlockLibrary
/**
* Build the render array for the block library.
*
* @param EntityLayoutInterface $entity_layout
* The entity layout to show allowed blocks for.
* @param ContentEntityInterface $content_entity
* The content entity the block is being added to.
*
* @return array
* The render array.
*/
protected function buildBlockLibrary(EntityLayoutInterface $entity_layout, ContentEntityInterface $content_entity = NULL)
{
$build['filter'] = ['#type' => 'search', '#title' => $this->t('Filter'), '#title_display' => 'invisible', '#size' => 30, '#placeholder' => $this->t('Filter by block name'), '#attributes' => ['class' => ['context-table-filter'], 'data-element' => '.block-add-table', 'title' => $this->t('Enter a part of the block name to filter by.')]];
$headers = [$this->t('Block'), $this->t('Category'), $this->t('Operations')];
$build['blocks'] = ['#type' => 'table', '#header' => $headers, '#rows' => [], '#empty' => $this->t('No blocks available for placement.'), '#attributes' => ['class' => ['block-add-table']]];
$blocks = $this->entityLayoutService->getSystemBlocks();
// Add each block definition to the table.
foreach ($blocks as $block_id => $block) {
if (!$entity_layout->blockIsAllowed($block_id)) {
continue;
}
$bundle_entity_type = $this->entityLayoutService->getTargetBundleEntityType($entity_layout);
// Use different routes depending on what kind of entity were adding
// blocks for.
if ($content_entity) {
$entity_type_id = $content_entity->getEntityTypeId();
$block_add_url = Url::fromRoute("entity_layout.{$entity_type_id}.content.block.add", ['block_id' => $block_id, $entity_type_id => $content_entity->id()]);
} else {
$entity_type_id = $entity_layout->getTargetEntityType();
$block_add_url = Url::fromRoute("entity_layout.{$entity_type_id}.block.add", ['block_id' => $block_id, $bundle_entity_type => $entity_layout->getTargetBundle()]);
}
$links = ['add' => ['title' => $this->t('Place block'), 'url' => $block_add_url, 'attributes' => ['class' => ['use-ajax'], 'data-dialog-type' => 'modal', 'data-dialog-options' => Json::encode(['width' => 700])]]];
$build['blocks']['#rows'][] = ['title' => ['data' => ['#type' => 'inline_template', '#template' => '<div class="context-table-filter-text-source">{{ label }}</div>', '#context' => ['label' => $block['admin_label']]]], 'category' => ['data' => $block['category']], 'operations' => ['data' => ['#type' => 'operations', '#links' => $links]]];
}
// @todo Create a filter behaviour for the table.
//$build['#attached']['library'][] = 'context_ui/admin';
return $build;
}
示例10: overviewRow
/**
* Builds a table row for overview form.
*
* @param array ContentEntityInterface $entity
* Data needed to build the list row.
* @param array $bundles
* The array of bundles.
*
* @return array
*/
public function overviewRow(ContentEntityInterface $entity, array $bundles)
{
$label = $entity->label() ?: $this->t('@type: @id', array('@type' => $entity->getEntityTypeId(), '@id' => $entity->id()));
// Get existing translations and current job items for the entity
// to determine translation statuses
$translations = $entity->getTranslationLanguages();
$source_lang = $entity->language()->getId();
$current_job_items = tmgmt_job_item_load_latest('content', $entity->getEntityTypeId(), $entity->id(), $source_lang);
$row = array('id' => $entity->id(), 'title' => $entity->hasLinkTemplate('canonical') ? $entity->toLink($label, 'canonical')->toString() : ($entity->label() ?: $entity->id()));
if (count($bundles) > 1) {
$row['bundle'] = isset($bundles[$entity->bundle()]) ? $bundles[$entity->bundle()] : t('Unknown');
}
// Load entity translation specific data.
$manager = \Drupal::service('content_translation.manager');
foreach (\Drupal::languageManager()->getLanguages() as $langcode => $language) {
$translation_status = 'current';
if ($langcode == $source_lang) {
$translation_status = 'original';
} elseif (!isset($translations[$langcode])) {
$translation_status = 'missing';
} elseif ($translation = $entity->getTranslation($langcode)) {
$metadata = $manager->getTranslationMetadata($translation);
if ($metadata->isOutdated()) {
$translation_status = 'outofdate';
}
}
$build = $this->buildTranslationStatus($translation_status, isset($current_job_items[$langcode]) ? $current_job_items[$langcode] : NULL);
$row['langcode-' . $langcode] = ['data' => \Drupal::service('renderer')->render($build), 'class' => array('langstatus-' . $langcode)];
}
return $row;
}
示例11: makePreview
/**
* Builds the entity translation for the provided translation data.
*
* @param \Drupal\Core\Entity\ContentEntityInterface $entity
* The entity for which the translation should be returned.
* @param array $data
* The translation data for the fields.
* @param string $target_langcode
* The target language.
*
* @return \Drupal\Core\Entity\ContentEntityInterface $translation
* Translation data.
*/
protected function makePreview(ContentEntityInterface $entity, array $data, $target_langcode)
{
// If the translation for this language does not exist yet, initialize it.
if (!$entity->hasTranslation($target_langcode)) {
$entity->addTranslation($target_langcode, $entity->toArray());
}
$embeded_fields = $this->config('tmgmt_content.settings')->get('embedded_fields');
$translation = $entity->getTranslation($target_langcode);
foreach ($data as $name => $field_data) {
foreach (Element::children($field_data) as $delta) {
$field_item = $field_data[$delta];
foreach (Element::children($field_item) as $property) {
$property_data = $field_item[$property];
// If there is translation data for the field property, save it.
if (isset($property_data['#translation']['#text']) && $property_data['#translate']) {
$translation->get($name)->offsetGet($delta)->set($property, $property_data['#translation']['#text']);
} elseif (isset($embeded_fields[$entity->getEntityTypeId()][$name])) {
$this->makePreview($translation->get($name)->offsetGet($delta)->{$property}, $property_data, $target_langcode);
}
}
}
}
return $translation;
}
示例12: buildRecord
/**
* @param \Drupal\Core\Entity\ContentEntityInterface $entity
* @return array
*/
protected function buildRecord(ContentEntityInterface $entity)
{
return array('entity_type_id' => $entity->getEntityTypeId(), 'entity_id' => $entity->id(), 'entity_uuid' => $entity->uuid(), 'revision_id' => $entity->getRevisionId(), 'deleted' => $entity->_deleted->value, 'rev' => $entity->_rev->value, 'seq' => $this->multiversionManager->newSequenceId(), 'local' => (bool) $entity->getEntityType()->get('local'), 'is_stub' => (bool) $entity->_rev->is_stub);
}
示例13: revisionOverview
/**
* Generates an overview table of older revisions of an entity.
*
* @param \Drupal\Core\Entity\ContentEntityInterface $entity
* An entity object.
*
* @return array
* An array as expected by drupal_render().
*/
public function revisionOverview(ContentEntityInterface $entity)
{
$langcode = $this->languageManager()->getCurrentLanguage(LanguageInterface::TYPE_CONTENT)->getId();
/** @var \Drupal\content_entity_base\Entity\Storage\RevisionableStorageInterface $entity_storage */
$entity_storage = $this->entityManager()->getStorage($entity->getEntityTypeId());
$header = array($this->t('Revision'), $this->t('Operations'));
$rows = [];
$vids = $entity_storage->revisionIds($entity);
$entity_revisions = array_combine($vids, array_map(function ($vid) use($entity_storage) {
return $entity_storage->loadRevision($vid);
}, $vids));
$latest_revision = TRUE;
foreach (array_reverse($vids) as $vid) {
$row = [];
/** @var \Drupal\Core\Entity\ContentEntityInterface $revision */
$revision = $entity_revisions[$vid];
if ($revision->hasTranslation($langcode) && $revision->getTranslation($langcode)->isRevisionTranslationAffected()) {
if ($latest_revision) {
$row[] = $this->getRevisionDescription($revision, TRUE);
$row[] = ['data' => ['#prefix' => '<em>', '#markup' => $this->t('Current revision'), '#suffix' => '</em>']];
foreach ($row as &$current) {
$current['class'] = ['revision-current'];
}
$latest_revision = FALSE;
} else {
$row[] = $this->getRevisionDescription($revision, FALSE);
$links = $this->getOperationLinks($revision);
$row[] = ['data' => ['#type' => 'operations', '#links' => $links]];
}
}
$rows[] = $row;
}
$build[$entity->getEntityTypeId() . '_revisions_table'] = array('#theme' => 'table', '#rows' => $rows, '#header' => $header);
// We have no clue about caching yet.
$build['#cache']['max-age'] = 0;
return $build;
}
示例14: transferBlocks
/**
* Transfer the supplied blocks to the specified content entity.
*
* @param EntityLayoutInterface $entity_layout
* The entity layout the entity layout blocks belongs to.
* @param ContentEntityInterface $content_entity
* The content entity to transfer blocks to.
* @param BlockPluginCollection $block_collection
* The blocks to transfer.
*
* @return EntityLayoutBlockInterface[]
*/
public function transferBlocks(EntityLayoutInterface $entity_layout, ContentEntityInterface $content_entity, BlockPluginCollection $block_collection)
{
$block_entities = [];
// Create a entity layout block entity from each default block
// configuration and create a new UUID.
/** @var BlockPluginInterface $block */
foreach ($block_collection as $block) {
$configuration = $block->getConfiguration();
$block_entity = EntityLayoutBlock::create(['layout' => $entity_layout->id(), 'config' => $configuration, 'entity_id' => $content_entity, 'entity_type' => $content_entity->getEntityTypeId()]);
$block_entities[] = $block_entity;
}
/** @var ContentEntityInterface $block_entity */
foreach ($block_entities as $block_entity) {
$block_entity->save();
}
return $block_entities;
}
示例15: createContentBlock
/**
* Create a new entity layout block.
*
* @param EntityLayoutInterface $entity_layout
* The entity layout object to create a block for.
* @param ContentEntityInterface $content_entity
* The content entity to associate the block with.
* @param array $configuration
* The block configuration.
*
* @return EntityLayoutBlockInterface|static
*/
public function createContentBlock(EntityLayoutInterface $entity_layout, ContentEntityInterface $content_entity, array $configuration)
{
$entity_layout_block = EntityLayoutBlock::create(['layout' => $entity_layout->id(), 'config' => $configuration, 'entity_id' => $content_entity, 'entity_type' => $content_entity->getEntityTypeId()]);
return $entity_layout_block;
}