Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello,
Is there a way to remove the default layouts provided by panels ? I would like to write my own and see only my own layout when I click on the layout link of the in-place editor.
I know I could delete the panels.layouts.yml, but I would use a method that is upgrade proof.
In the 7.x version of panels, we had an admin interface to select the layout we want to see available, is there an equivalent for d8 ?
Thanks
Alex
Comments
Comment #2
othermachines CreditAttribution: othermachines commentedJust figured this out myself. Unfortunately there doesn't appear to be an interface for that (yet) in D8. I implemented the following hook (provided by layout_plugin) in a custom module.
Edit: Updated - there are now (since Layout discovery replaced Layout plugin) fewer default layouts and their names are now prefixed with "layout_".
Hope that helps.
Comment #3
DamienMcKennaYou might like #2849219: Provide hook to alter available layouts for IPE and follow #2764897: Make available layouts and blocks configurable.
Comment #4
thomas.frobieterShould #2 still work?
I got: "Drupal\Component\Plugin\Exception\PluginNotFoundException: The "layout_onecol" plugin does not exist. in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 52 of core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php)."
If i print out $definitions with kint, i can see "layout_onecol" etc.
Comment #5
thomas.frobieterOkay, it does work for every other layout except "layout_onecol" - maybe because this is already set as default everywhere. But i'm fine with it.
Comment #6
othermachines CreditAttribution: othermachines commentedHi, @thomas.frobieter. I think you already figured this out, but I believe you're getting the error because it *is* working (you're unsetting it, so it doesn't exist). It should disappear if you change the defaults.
Comment #7
wereallmonks CreditAttribution: wereallmonks commented#2 still applies. I'm running some DS extras as well, so I had to add the select DS layouts in the same manner to unset those too.
Comment #8
rodpal CreditAttribution: rodpal commentedI'm using hook_plugin_filter_TYPE__CONSUMER_alter(array &$definitions, array $extra) to avoid error width default layout: "layout_onecol"