Loading modules/layout_builder_restrictions_by_region/src/Plugin/ConfigAction/EntityViewModeRestrictionByRegionAppendAllowedBlocks.php +7 −9 Original line number Diff line number Diff line Loading @@ -14,6 +14,8 @@ use Drupal\Core\StringTranslation\TranslatableMarkup; use Symfony\Component\DependencyInjection\ContainerInterface; /** * Appends one or more blocks to allowed blocks in layout builder restrictions. * * @internal * This API is experimental. */ Loading @@ -22,20 +24,17 @@ use Symfony\Component\DependencyInjection\ContainerInterface; admin_label: new TranslatableMarkup('Appends one or more blocks to allowed blocks in layout builder restrictions.'), entity_types: ['entity_view_display'], )] final class EntityViewModeRestrictionByRegionAppendAllowedBlocks implements ConfigActionPluginInterface, ContainerFactoryPluginInterface { final class EntityViewModeRestrictionByRegionAppendAllowedBlocks implements ConfigActionPluginInterface, ContainerFactoryPluginInterface { public function __construct( private readonly ConfigManagerInterface $configManager, ) { ) { } /** * {@inheritdoc} */ public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { return new static( $container->get(ConfigManagerInterface::class), ); Loading @@ -44,8 +43,7 @@ final class EntityViewModeRestrictionByRegionAppendAllowedBlocks implements Conf /** * {@inheritdoc} */ public function apply(string $configName, mixed $values): void { public function apply(string $configName, mixed $values): void { $entity = $this->configManager->loadConfigEntityByName($configName); assert($entity instanceof ConfigEntityInterface); assert(is_array($values)); Loading @@ -64,7 +62,7 @@ final class EntityViewModeRestrictionByRegionAppendAllowedBlocks implements Conf throw new ConfigActionException("You need to define at least one layout to append."); } $regions = isset($value['regions']) ? $value['regions'] : ['all_regions']; $regions = $value['regions'] ?? ['all_regions']; foreach ($value['layouts'] as $layout) { foreach ($regions as $region) { Loading modules/layout_builder_restrictions_by_region/src/Plugin/ConfigAction/EntityViewModeRestrictionByRegionAppendRestrictedBlocks.php +7 −9 Original line number Diff line number Diff line Loading @@ -14,6 +14,8 @@ use Drupal\Core\StringTranslation\TranslatableMarkup; use Symfony\Component\DependencyInjection\ContainerInterface; /** * Appends one or more blocks to restricted blocks. * * @internal * This API is experimental. */ Loading @@ -22,20 +24,17 @@ use Symfony\Component\DependencyInjection\ContainerInterface; admin_label: new TranslatableMarkup('Appends one or more blocks to restricted blocks in layout builder restrictions.'), entity_types: ['entity_view_display'], )] final class EntityViewModeRestrictionByRegionAppendRestrictedBlocks implements ConfigActionPluginInterface, ContainerFactoryPluginInterface { final class EntityViewModeRestrictionByRegionAppendRestrictedBlocks implements ConfigActionPluginInterface, ContainerFactoryPluginInterface { public function __construct( private readonly ConfigManagerInterface $configManager, ) { ) { } /** * {@inheritdoc} */ public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { return new static( $container->get(ConfigManagerInterface::class), ); Loading @@ -44,8 +43,7 @@ final class EntityViewModeRestrictionByRegionAppendRestrictedBlocks implements C /** * {@inheritdoc} */ public function apply(string $configName, mixed $values): void { public function apply(string $configName, mixed $values): void { $entity = $this->configManager->loadConfigEntityByName($configName); assert($entity instanceof ConfigEntityInterface); assert(is_array($values)); Loading @@ -64,7 +62,7 @@ final class EntityViewModeRestrictionByRegionAppendRestrictedBlocks implements C throw new ConfigActionException("You need to define at least one layout to append."); } $regions = isset($value['regions']) ? $value['regions'] : ['all_regions']; $regions = $value['regions'] ?? ['all_regions']; foreach ($value['layouts'] as $layout) { foreach ($regions as $region) { Loading src/Attribute/LayoutBuilderRestriction.php +3 −1 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ use Drupal\Core\StringTranslation\TranslatableMarkup; /** * Defines a Layout Builder Restriction attribute for plugin discovery. * * @see plugin_api */ #[\Attribute(\Attribute::TARGET_CLASS)] Loading @@ -27,7 +28,8 @@ class LayoutBuilderRestriction extends Plugin { public function __construct( public readonly string $id, public readonly TranslatableMarkup $title, public readonly TranslatableMarkup $description public readonly TranslatableMarkup $description, ) { } } src/Plugin/ConfigAction/EntityViewModeRestrictionAppendBlocks.php +6 −8 Original line number Diff line number Diff line Loading @@ -14,6 +14,8 @@ use Drupal\Core\StringTranslation\TranslatableMarkup; use Symfony\Component\DependencyInjection\ContainerInterface; /** * Appends one or more blocks to allowed blocks in layout builder restrictions. * * @internal * This API is experimental. */ Loading @@ -22,20 +24,17 @@ use Symfony\Component\DependencyInjection\ContainerInterface; admin_label: new TranslatableMarkup('Appends one or more blocks to allowed blocks in layout builder restrictions.'), entity_types: ['entity_view_display'], )] final class EntityViewModeRestrictionAppendBlocks implements ConfigActionPluginInterface, ContainerFactoryPluginInterface { final class EntityViewModeRestrictionAppendBlocks implements ConfigActionPluginInterface, ContainerFactoryPluginInterface { public function __construct( private readonly ConfigManagerInterface $configManager, ) { ) { } /** * {@inheritdoc} */ public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { return new static( $container->get(ConfigManagerInterface::class), ); Loading @@ -44,8 +43,7 @@ final class EntityViewModeRestrictionAppendBlocks implements ConfigActionPluginI /** * {@inheritdoc} */ public function apply(string $configName, mixed $values): void { public function apply(string $configName, mixed $values): void { $entity = $this->configManager->loadConfigEntityByName($configName); assert($entity instanceof ConfigEntityInterface); assert(is_array($values)); Loading src/Plugin/ConfigAction/EntityViewModeRestrictionRestrictBlocks.php +6 −8 Original line number Diff line number Diff line Loading @@ -14,6 +14,8 @@ use Drupal\Core\StringTranslation\TranslatableMarkup; use Symfony\Component\DependencyInjection\ContainerInterface; /** * Appends one or more blocks to restricted blocks. * * @internal * This API is experimental. */ Loading @@ -22,20 +24,17 @@ use Symfony\Component\DependencyInjection\ContainerInterface; admin_label: new TranslatableMarkup('Appends one or more blocks to restricted blocks in layout builder restrictions.'), entity_types: ['entity_view_display'], )] final class EntityViewModeRestrictionRestrictBlocks implements ConfigActionPluginInterface, ContainerFactoryPluginInterface { final class EntityViewModeRestrictionRestrictBlocks implements ConfigActionPluginInterface, ContainerFactoryPluginInterface { public function __construct( private readonly ConfigManagerInterface $configManager, ) { ) { } /** * {@inheritdoc} */ public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { return new static( $container->get(ConfigManagerInterface::class), ); Loading @@ -44,8 +43,7 @@ final class EntityViewModeRestrictionRestrictBlocks implements ConfigActionPlugi /** * {@inheritdoc} */ public function apply(string $configName, mixed $values): void { public function apply(string $configName, mixed $values): void { $entity = $this->configManager->loadConfigEntityByName($configName); assert($entity instanceof ConfigEntityInterface); assert(is_array($values)); Loading Loading
modules/layout_builder_restrictions_by_region/src/Plugin/ConfigAction/EntityViewModeRestrictionByRegionAppendAllowedBlocks.php +7 −9 Original line number Diff line number Diff line Loading @@ -14,6 +14,8 @@ use Drupal\Core\StringTranslation\TranslatableMarkup; use Symfony\Component\DependencyInjection\ContainerInterface; /** * Appends one or more blocks to allowed blocks in layout builder restrictions. * * @internal * This API is experimental. */ Loading @@ -22,20 +24,17 @@ use Symfony\Component\DependencyInjection\ContainerInterface; admin_label: new TranslatableMarkup('Appends one or more blocks to allowed blocks in layout builder restrictions.'), entity_types: ['entity_view_display'], )] final class EntityViewModeRestrictionByRegionAppendAllowedBlocks implements ConfigActionPluginInterface, ContainerFactoryPluginInterface { final class EntityViewModeRestrictionByRegionAppendAllowedBlocks implements ConfigActionPluginInterface, ContainerFactoryPluginInterface { public function __construct( private readonly ConfigManagerInterface $configManager, ) { ) { } /** * {@inheritdoc} */ public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { return new static( $container->get(ConfigManagerInterface::class), ); Loading @@ -44,8 +43,7 @@ final class EntityViewModeRestrictionByRegionAppendAllowedBlocks implements Conf /** * {@inheritdoc} */ public function apply(string $configName, mixed $values): void { public function apply(string $configName, mixed $values): void { $entity = $this->configManager->loadConfigEntityByName($configName); assert($entity instanceof ConfigEntityInterface); assert(is_array($values)); Loading @@ -64,7 +62,7 @@ final class EntityViewModeRestrictionByRegionAppendAllowedBlocks implements Conf throw new ConfigActionException("You need to define at least one layout to append."); } $regions = isset($value['regions']) ? $value['regions'] : ['all_regions']; $regions = $value['regions'] ?? ['all_regions']; foreach ($value['layouts'] as $layout) { foreach ($regions as $region) { Loading
modules/layout_builder_restrictions_by_region/src/Plugin/ConfigAction/EntityViewModeRestrictionByRegionAppendRestrictedBlocks.php +7 −9 Original line number Diff line number Diff line Loading @@ -14,6 +14,8 @@ use Drupal\Core\StringTranslation\TranslatableMarkup; use Symfony\Component\DependencyInjection\ContainerInterface; /** * Appends one or more blocks to restricted blocks. * * @internal * This API is experimental. */ Loading @@ -22,20 +24,17 @@ use Symfony\Component\DependencyInjection\ContainerInterface; admin_label: new TranslatableMarkup('Appends one or more blocks to restricted blocks in layout builder restrictions.'), entity_types: ['entity_view_display'], )] final class EntityViewModeRestrictionByRegionAppendRestrictedBlocks implements ConfigActionPluginInterface, ContainerFactoryPluginInterface { final class EntityViewModeRestrictionByRegionAppendRestrictedBlocks implements ConfigActionPluginInterface, ContainerFactoryPluginInterface { public function __construct( private readonly ConfigManagerInterface $configManager, ) { ) { } /** * {@inheritdoc} */ public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { return new static( $container->get(ConfigManagerInterface::class), ); Loading @@ -44,8 +43,7 @@ final class EntityViewModeRestrictionByRegionAppendRestrictedBlocks implements C /** * {@inheritdoc} */ public function apply(string $configName, mixed $values): void { public function apply(string $configName, mixed $values): void { $entity = $this->configManager->loadConfigEntityByName($configName); assert($entity instanceof ConfigEntityInterface); assert(is_array($values)); Loading @@ -64,7 +62,7 @@ final class EntityViewModeRestrictionByRegionAppendRestrictedBlocks implements C throw new ConfigActionException("You need to define at least one layout to append."); } $regions = isset($value['regions']) ? $value['regions'] : ['all_regions']; $regions = $value['regions'] ?? ['all_regions']; foreach ($value['layouts'] as $layout) { foreach ($regions as $region) { Loading
src/Attribute/LayoutBuilderRestriction.php +3 −1 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ use Drupal\Core\StringTranslation\TranslatableMarkup; /** * Defines a Layout Builder Restriction attribute for plugin discovery. * * @see plugin_api */ #[\Attribute(\Attribute::TARGET_CLASS)] Loading @@ -27,7 +28,8 @@ class LayoutBuilderRestriction extends Plugin { public function __construct( public readonly string $id, public readonly TranslatableMarkup $title, public readonly TranslatableMarkup $description public readonly TranslatableMarkup $description, ) { } }
src/Plugin/ConfigAction/EntityViewModeRestrictionAppendBlocks.php +6 −8 Original line number Diff line number Diff line Loading @@ -14,6 +14,8 @@ use Drupal\Core\StringTranslation\TranslatableMarkup; use Symfony\Component\DependencyInjection\ContainerInterface; /** * Appends one or more blocks to allowed blocks in layout builder restrictions. * * @internal * This API is experimental. */ Loading @@ -22,20 +24,17 @@ use Symfony\Component\DependencyInjection\ContainerInterface; admin_label: new TranslatableMarkup('Appends one or more blocks to allowed blocks in layout builder restrictions.'), entity_types: ['entity_view_display'], )] final class EntityViewModeRestrictionAppendBlocks implements ConfigActionPluginInterface, ContainerFactoryPluginInterface { final class EntityViewModeRestrictionAppendBlocks implements ConfigActionPluginInterface, ContainerFactoryPluginInterface { public function __construct( private readonly ConfigManagerInterface $configManager, ) { ) { } /** * {@inheritdoc} */ public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { return new static( $container->get(ConfigManagerInterface::class), ); Loading @@ -44,8 +43,7 @@ final class EntityViewModeRestrictionAppendBlocks implements ConfigActionPluginI /** * {@inheritdoc} */ public function apply(string $configName, mixed $values): void { public function apply(string $configName, mixed $values): void { $entity = $this->configManager->loadConfigEntityByName($configName); assert($entity instanceof ConfigEntityInterface); assert(is_array($values)); Loading
src/Plugin/ConfigAction/EntityViewModeRestrictionRestrictBlocks.php +6 −8 Original line number Diff line number Diff line Loading @@ -14,6 +14,8 @@ use Drupal\Core\StringTranslation\TranslatableMarkup; use Symfony\Component\DependencyInjection\ContainerInterface; /** * Appends one or more blocks to restricted blocks. * * @internal * This API is experimental. */ Loading @@ -22,20 +24,17 @@ use Symfony\Component\DependencyInjection\ContainerInterface; admin_label: new TranslatableMarkup('Appends one or more blocks to restricted blocks in layout builder restrictions.'), entity_types: ['entity_view_display'], )] final class EntityViewModeRestrictionRestrictBlocks implements ConfigActionPluginInterface, ContainerFactoryPluginInterface { final class EntityViewModeRestrictionRestrictBlocks implements ConfigActionPluginInterface, ContainerFactoryPluginInterface { public function __construct( private readonly ConfigManagerInterface $configManager, ) { ) { } /** * {@inheritdoc} */ public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { return new static( $container->get(ConfigManagerInterface::class), ); Loading @@ -44,8 +43,7 @@ final class EntityViewModeRestrictionRestrictBlocks implements ConfigActionPlugi /** * {@inheritdoc} */ public function apply(string $configName, mixed $values): void { public function apply(string $configName, mixed $values): void { $entity = $this->configManager->loadConfigEntityByName($configName); assert($entity instanceof ConfigEntityInterface); assert(is_array($values)); Loading