function RenderCallbacks::alterLayoutBuilder
Same name in other branches
- 10 core/modules/navigation/src/RenderCallbacks.php \Drupal\navigation\RenderCallbacks::alterLayoutBuilder()
Pre-render callback for layout builder.
File
-
core/
modules/ navigation/ src/ RenderCallbacks.php, line 20
Class
- RenderCallbacks
- Defines a class for render element callbacks.
Namespace
Drupal\navigationCode
public static function alterLayoutBuilder(array $element) : array {
if (($element['#section_storage'] ?? NULL) instanceof NavigationSectionStorage) {
// Remove add section links that exist before and after the existing
// section.
unset($element['layout_builder'][0], $element['layout_builder'][2]);
// Remove add block link from the footer section and the remove and
// configure buttons from the existing section.
unset($element['layout_builder'][1]['remove'], $element['layout_builder'][1]['configure'], $element['layout_builder'][1]['layout-builder__section']['footer']['layout_builder_add_block']);
}
return $element;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.