function layout_builder_plugin_filter_layout__layout_builder_alter
Same name in other branches
- 9 core/modules/layout_builder/layout_builder.module \layout_builder_plugin_filter_layout__layout_builder_alter()
- 8.9.x core/modules/layout_builder/layout_builder.module \layout_builder_plugin_filter_layout__layout_builder_alter()
- 11.x core/modules/layout_builder/layout_builder.module \layout_builder_plugin_filter_layout__layout_builder_alter()
Implements hook_plugin_filter_TYPE__CONSUMER_alter().
File
-
core/
modules/ layout_builder/ layout_builder.module, line 297
Code
function layout_builder_plugin_filter_layout__layout_builder_alter(array &$definitions, array $extra) {
// Remove layouts provide by layout discovery that are not needed because of
// layouts provided by this module.
$duplicate_layouts = [
'layout_twocol',
'layout_twocol_bricks',
'layout_threecol_25_50_25',
'layout_threecol_33_34_33',
];
foreach ($duplicate_layouts as $duplicate_layout) {
/** @var \Drupal\Core\Layout\LayoutDefinition[] $definitions */
if (isset($definitions[$duplicate_layout])) {
if ($definitions[$duplicate_layout]->getProvider() === 'layout_discovery') {
unset($definitions[$duplicate_layout]);
}
}
}
// Move the one column layout to the top.
if (isset($definitions['layout_onecol']) && $definitions['layout_onecol']->getProvider() === 'layout_discovery') {
$one_col = $definitions['layout_onecol'];
unset($definitions['layout_onecol']);
$definitions = [
'layout_onecol' => $one_col,
] + $definitions;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.