This module allows for more granular access control to Layout Builder by providing a set of permissions.
1.x
Features:
- control access to layout builder page
- control access to create/remove sections
- control access to add and configure blocks
- control access to edit block content
- control access to reordering blocks
- control access to pages user owns
2.x
The 2.x version of this module automagically generates a set of permissions based on available layouts, content types and block types. It provides an API module that defines a LayoutBuilderPermission plugin type and a set of submodules that provide plugins of this type for common use cases.
One can also define their own permissions. The Layout Builder Advanced Permissions module uses plugin discovery to find and apply permissions. To add your own
permissions, you can add a class that extends \Drupal\layout_builder_perms\LayoutBuilderPermissionBase
and is
annotated with the \Drupal\layout_builder_perms\Annotation\LayoutBuilderPermission
annotation. The class file should
be created in a ./src/Plugin/LayoutBuilderPermission folder in your custom module.
Each plugin should define a permission for a single operation in the layout builder. Supported operations are:
- Add a section: section_add
- Update a section: section_edit
- Remove a section: section_remove
- Add a block: block_add
- Configure a block: block_config
- Move a block: block_reorder
- Remove a block: block_remove
To create a plugin for each of these operations in a given context you can use a plugin deriver. A base class
\Drupal\layout_builder_perms\LayoutBuilderPermissionPluginDeriverBase
is available to make your life easier here.
See the Layout Builder Advanced Permissions Global submodule for an example.
Project information
- Minimally maintained
Maintainers monitor issues, but fast responses are not guaranteed. - Maintenance fixes only
Considered feature-complete by its maintainers. - Module categories: Administration Tools, Access Control, Content Display
- Ecosystem: Layout Builder
- 315 sites report using this module
- Created by sdstyles on , updated
- Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.