function LayoutBuilderEntityFormTrait::buildActions
Same name in other branches
- 10 core/modules/layout_builder/src/Form/LayoutBuilderEntityFormTrait.php \Drupal\layout_builder\Form\LayoutBuilderEntityFormTrait::buildActions()
Builds the actions for the form.
Parameters
array $actions: The actions array to modify.
Return value
array The modified actions array.
3 calls to LayoutBuilderEntityFormTrait::buildActions()
- DefaultsEntityForm::actions in core/
modules/ layout_builder/ src/ Form/ DefaultsEntityForm.php - Returns an array of supported actions for the current entity form.
- LayoutForm::buildForm in core/
modules/ navigation/ src/ Form/ LayoutForm.php - Form constructor.
- OverridesEntityForm::actions in core/
modules/ layout_builder/ src/ Form/ OverridesEntityForm.php - Returns an array of supported actions for the current entity form.
File
-
core/
modules/ layout_builder/ src/ Form/ LayoutBuilderEntityFormTrait.php, line 80
Class
- LayoutBuilderEntityFormTrait
- Provides a trait for common methods used in Layout Builder entity forms.
Namespace
Drupal\layout_builder\FormCode
protected function buildActions(array $actions) : array {
$actions['#attributes']['role'] = 'region';
$actions['#attributes']['aria-label'] = $this->t('Layout Builder tools');
$actions['submit']['#value'] = $this->t('Save layout');
$actions['#weight'] = -1000;
$actions['discard_changes'] = [
'#type' => 'submit',
'#value' => $this->t('Discard changes'),
'#submit' => [
'::redirectOnSubmit',
],
'#redirect' => 'discard_changes',
];
$actions['preview_toggle'] = $this->buildContentPreviewToggle();
return $actions;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.