You are here

protected function LayoutEntityHelperTrait::isEntityUsingFieldOverride in Drupal 8

Determines if an entity is using a field for the layout override.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity.

Return value

bool TRUE if the entity is using a field for a layout override.

Deprecated

in drupal:8.7.0 and is removed from drupal:9.0.0. To determine if an entity has a layout override, use \Drupal\layout_builder\LayoutEntityHelperTrait::getSectionStorageForEntity() and check whether the result is an instance of \Drupal\layout_builder\DefaultsSectionStorageInterface.

See also

https://www.drupal.org/node/3030609

File

core/modules/layout_builder/src/LayoutEntityHelperTrait.php, line 144

Class

LayoutEntityHelperTrait
Methods to help with entities using the layout builder.

Namespace

Drupal\layout_builder

Code

protected function isEntityUsingFieldOverride(EntityInterface $entity) {
  @trigger_error('\\Drupal\\layout_builder\\LayoutEntityHelperTrait::isEntityUsingFieldOverride() is deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. Internal storage of overrides may change so the existence of the field does not necessarily guarantee an overridable entity. See https://www.drupal.org/node/3030609.', E_USER_DEPRECATED);
  return $entity instanceof FieldableEntityInterface && $entity
    ->hasField(OverridesSectionStorage::FIELD_NAME);
}