FieldLayoutEntityDisplayTrait
trait FieldLayoutEntityDisplayTrait (View source)
Provides shared code for entity displays.
Both EntityViewDisplay and EntityFormDisplay must maintain their parent hierarchy, while being identically enhanced by Field Layout. This trait contains the code they both share.
Methods
Gets a layout definition.
Implements \Drupal\field_layout\Display\EntityDisplayWithLayoutInterface::getLayoutId().
Implements \Drupal\field_layout\Display\EntityDisplayWithLayoutInterface::getLayoutSettings().
Implements \Drupal\field_layout\Display\EntityDisplayWithLayoutInterface::setLayoutId().
Implements \Drupal\field_layout\Display\EntityDisplayWithLayoutInterface::setLayout().
Implements \Drupal\field_layout\Display\EntityDisplayWithLayoutInterface::getLayout().
Gets the layout plugin.
Overrides \Drupal\Core\Entity\EntityDisplayBase::init().
Overrides \Drupal\Core\Entity\EntityDisplayBase::preSave().
{@inheritdoc}
Overrides \Drupal\Core\Entity\EntityDisplayBase::calculateDependencies().
Implements \Drupal\field_layout\Display\EntityDisplayWithLayoutInterface::getDefaultRegion().
Details
protected LayoutDefinition
getLayoutDefinition(string $layout_id)
Gets a layout definition.
getLayoutId()
Implements \Drupal\field_layout\Display\EntityDisplayWithLayoutInterface::getLayoutId().
getLayoutSettings()
Implements \Drupal\field_layout\Display\EntityDisplayWithLayoutInterface::getLayoutSettings().
setLayoutId($layout_id, array $layout_settings = [])
Implements \Drupal\field_layout\Display\EntityDisplayWithLayoutInterface::setLayoutId().
setLayout(LayoutInterface $layout)
Implements \Drupal\field_layout\Display\EntityDisplayWithLayoutInterface::setLayout().
getLayout()
Implements \Drupal\field_layout\Display\EntityDisplayWithLayoutInterface::getLayout().
protected LayoutInterface
doGetLayout(string $layout_id, array $layout_settings)
Gets the layout plugin.
protected
init()
Overrides \Drupal\Core\Entity\EntityDisplayBase::init().
preSave(EntityStorageInterface $storage)
Overrides \Drupal\Core\Entity\EntityDisplayBase::preSave().
ensureLayout($default_layout_id = 'layout_onecol')
{@inheritdoc}
calculateDependencies()
Overrides \Drupal\Core\Entity\EntityDisplayBase::calculateDependencies().
Ensure the plugin dependencies are included. Once layouts are no longer stored as third party settings, this will be handled by the code in \Drupal\Core\Config\Entity\ConfigEntityBase::calculateDependencies() that handles \Drupal\Core\Entity\EntityWithPluginCollectionInterface.
getDefaultRegion()
Implements \Drupal\field_layout\Display\EntityDisplayWithLayoutInterface::getDefaultRegion().