function DefaultsEntityForm::buildMessage
Same name in other branches
- 9 core/modules/layout_builder/src/Form/DefaultsEntityForm.php \Drupal\layout_builder\Form\DefaultsEntityForm::buildMessage()
- 8.9.x core/modules/layout_builder/src/Form/DefaultsEntityForm.php \Drupal\layout_builder\Form\DefaultsEntityForm::buildMessage()
- 10 core/modules/layout_builder/src/Form/DefaultsEntityForm.php \Drupal\layout_builder\Form\DefaultsEntityForm::buildMessage()
Renders a message to display at the top of the layout builder.
Parameters
\Drupal\layout_builder\Entity\LayoutEntityDisplayInterface $entity: The entity view display being edited.
Return value
array A renderable array containing the message.
1 call to DefaultsEntityForm::buildMessage()
- DefaultsEntityForm::buildForm in core/
modules/ layout_builder/ src/ Form/ DefaultsEntityForm.php - Form constructor.
File
-
core/
modules/ layout_builder/ src/ Form/ DefaultsEntityForm.php, line 108
Class
- DefaultsEntityForm
- Provides a form containing the Layout Builder UI for defaults.
Namespace
Drupal\layout_builder\FormCode
protected function buildMessage(LayoutEntityDisplayInterface $entity) {
$entity_type_id = $entity->getTargetEntityTypeId();
$entity_type = $this->entityTypeManager
->getDefinition($entity_type_id);
$bundle_info = $this->entityTypeBundleInfo
->getBundleInfo($entity_type_id);
$args = [
'@bundle' => $bundle_info[$entity->getTargetBundle()]['label'],
'@plural_label' => $entity_type->getPluralLabel(),
];
if ($entity_type->hasKey('bundle')) {
$message = $this->t('You are editing the layout template for all @bundle @plural_label.', $args);
}
else {
$message = $this->t('You are editing the layout template for all @plural_label.', $args);
}
return $this->buildMessageContainer($message, 'defaults');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.