Commit 291f642c authored by Benji Fisher's avatar Benji Fisher
Browse files

task: #3573881 Fix coding standards violations

By: benjifisher
By: mark_fullmer
parent 1f94dd9f
Loading
Loading
Loading
Loading
Loading
+7 −9
Original line number Diff line number Diff line
@@ -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.
 */
@@ -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),
    );
@@ -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));
@@ -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) {
+7 −9
Original line number Diff line number Diff line
@@ -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.
 */
@@ -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),
    );
@@ -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));
@@ -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) {
+3 −1
Original line number Diff line number Diff line
@@ -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)]
@@ -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,
  ) {
  }

}
+6 −8
Original line number Diff line number Diff line
@@ -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.
 */
@@ -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),
    );
@@ -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));
+6 −8
Original line number Diff line number Diff line
@@ -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.
 */
@@ -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),
    );
@@ -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