function hook_layout_builder_restrictions_allowed_block_keys in Layout Builder Restrictions 8
Tell the module which block providers are available to Layout Builder.
Return value
array An array of keys.
2 invocations of hook_layout_builder_restrictions_allowed_block_keys()
- LayoutBuilderRestrictionsSubscriber::alterBlockChooser in src/
EventSubscriber/ LayoutBuilderRestrictionsSubscriber.php - Alters the block providers available in Layout Builder's choose_block.
- layout_builder_restrictions_plugin_filter_block__layout_builder_alter in ./
layout_builder_restrictions.module - Implements hook_plugin_filter_TYPE__CONSUMER_alter().
File
- ./
layout_builder_restrictions.api.php, line 14 - Api.php for layout_builder_restrictions.
Code
function hook_layout_builder_restrictions_allowed_block_keys() {
// Whitelist which block providers (e.g., System, Content, Menus)
// are available to Layout Builder. In the example below, only
// entity fields, Views blocks, and custom blocks will be available.
// This hook will apply to all entities that use Layout Builder.
return [
(string) t('Content'),
(string) t('Lists (Views)'),
(string) t('Block'),
];
}