- Issue created by @f0ns
- 🇧🇪Belgium f0ns
So for reasons beyond my control the "navigation_layout" seems to exist (core module navigation) and is something that is considered needed.
If that's the case it would be best to alter this module so you can't disable it (since it will throw the error I mention).
For now I disabled this module and disabled / hide the layouts with the following code in case somebody has the same problem as I do.
In this example I hide all the layouts except the one col layout.
/** * Implements hook_layout_alter(). */ function YOUR_MODULE_layout_alter(&$definitions) { // an array of layouts to keep. $layoutsWhitelist = ['navigation_layout']; // layouts that are required and cannot be removed. $requiredLayouts = ['layout_onecol', 'layout_builder_blank']; $layouts = array_merge($requiredLayouts, $layoutsWhitelist); $definitions = array_filter( $definitions, static fn(string $id) => in_array($id, $layouts, true), ARRAY_FILTER_USE_KEY ); }
/** * Implements hook_preprocess_item_list__layouts(). */ function YOUR_MODULE_preprocess_item_list__layouts(&$variables) { // For some reason removing this layout breaks the website so we hide it. $layoutToHide = ['navigation_layout']; $variables['items'] = array_filter( $variables['items'], static fn(string $id) => !in_array($id, $layoutToHide, true), ARRAY_FILTER_USE_KEY ); }
- 🇧🇪Belgium f0ns
I've added a patch to make sure "navigation_layout" can't be disabled anymore.
- Status changed to Needs review
3 months ago 6:51pm 3 September 2024 - Status changed to RTBC
3 months ago 1:18am 4 September 2024 - 🇵🇭Philippines paraderojether
Hi f0ns,
I reviewed patch #5, applied it against Layout disable 2.0.3, and confirmed the "navigation_layout" can't be disabled anymore.
I added screenshots for reference.
Thank you. - Status changed to Needs work
3 months ago 7:16am 4 September 2024 - 🇩🇪Germany Anybody Porta Westfalica
Please prepare this as MR and provide reference as inline comment to this issue and the code in core where navigation_layout is required. Thanks!