Commit 74524f64 authored by vincent baronnet's avatar vincent baronnet
Browse files

Issue #3295668 by atul ghate,JatinGupta40,mrinalini9,sourabhjain,Shubham...

Issue #3295668 by atul ghate,JatinGupta40,mrinalini9,sourabhjain,Shubham Sharma 77,nitin_lama,shamir.vs,alanmoreira: Drupal Coding standard issue fix
parent 518ab58a
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -74,7 +74,7 @@ function domain_entity_form_field_storage_config_edit_form_alter(&$form, FormSta
  if ($field_storage->getName() === DomainEntityMapper::FIELD_NAME) {
    $form['cardinality_container']['cardinality']['#access'] = FALSE;
    $form['cardinality_container']['cardinality_number']['#access'] = FALSE;
    $form['cardinality_container']['#description'] = t('This field widget allow only unlimited values (the number of active domain).');;
    $form['cardinality_container']['#description'] = t('This field widget allow only unlimited values (the number of active domain).');
  }
}

@@ -170,7 +170,7 @@ function domain_entity_get_user_available_domains(AccountInterface $account = NU
  $accessible_domain_ids = [$current_domain->id()];

  // Middle office editors with permission see in administration,
  // entity from her lists of assigned domains.
  // entity from lists of assigned domains.
  $route = \Drupal::routeMatch()->getRouteObject();
  $is_admin = \Drupal::service('router.admin_context')->isAdminRoute($route);

+0 −1
Original line number Diff line number Diff line
@@ -2,7 +2,6 @@ name: Domain Menu Access
description: 'Domain-based access control for Drupal core menu links.'
type: module
package: Domain
version: VERSION
core_version_requirement: ^9 || ^10
dependencies:
  - domain_entity:domain_entity
+3 −3
Original line number Diff line number Diff line
@@ -29,12 +29,12 @@ function domain_menu_access_form_menu_link_content_form_alter(&$form, FormStateI
  $entity = $form_object->getEntity();

  /** @var \Drupal\system\MenuInterface $menu */
  $form['domain'] = array(
  $form['domain'] = [
    '#type' => 'details',
    '#title' => t('Domain'),
    '#open' => TRUE,
    '#weight' => 25,
  );
  ];

  $form['domain']['#access'] = FALSE;
  $form[DomainEntityMapper::FIELD_NAME]['#group'] = 'domain';
@@ -57,7 +57,7 @@ function domain_menu_access_block_alter(&$definitions) {
      if (strpos($id, 'system_menu_block:') === 0) {
        $derivative_id = NULL;
        if (strpos($id, PluginBase::DERIVATIVE_SEPARATOR)) {
          list(, $derivative_id) = explode(PluginBase::DERIVATIVE_SEPARATOR, $id, 2);
          [, $derivative_id] = explode(PluginBase::DERIVATIVE_SEPARATOR, $id, 2);
        }
        if ($derivative_id) {
          /** @var \Drupal\system\MenuInterface $menu */
+4 −4
Original line number Diff line number Diff line
@@ -38,9 +38,9 @@ class DomainMenuAccessSettingsForm extends FormBase {
  /**
   * DomainMenuAccessSettingsForm constructor.
   *
   * @param BlockManagerInterface $block_manager
   * @param \Drupal\Core\Block\BlockManagerInterface $block_manager
   *   The block manager.
   * @param ConfigEntityStorageInterface $menu_storage
   * @param \Drupal\Core\Config\Entity\ConfigEntityStorageInterface $menu_storage
   *   The storage of menu entities.
   * @param \Drupal\Core\Messenger\MessengerInterface $messenger
   *   The messenger.
@@ -84,12 +84,12 @@ class DomainMenuAccessSettingsForm extends FormBase {
      ];
      /** @var \Drupal\system\Entity\Menu $item */
      foreach ($this->menuStorage->loadMultiple() as $key => $item) {
        $form[$key] = array(
        $form[$key] = [
          '#type' => 'checkbox',
          '#title' => $item->label(),
          '#default_value' => $item->getThirdPartySetting('domain_menu_access', 'access_enabled'),
          '#description' => $item->getDescription(),
        );
        ];
      }
    }

+5 −5
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ class DomainMenuLinkTreeManipulators {
   *
   * @var array
   */
  protected static $entityIdsToLoad = array();
  protected static $entityIdsToLoad = [];

  /**
   * Creates DomainMenuLinkTreeManipulators object.
@@ -96,7 +96,7 @@ class DomainMenuLinkTreeManipulators {
      }

      if (isset($tree[$key]->access)) {
        $tree[$key]->access->addCacheContexts(array('url.site'));
        $tree[$key]->access->addCacheContexts(['url.site']);
      }
    }

@@ -172,14 +172,14 @@ class DomainMenuLinkTreeManipulators {
      // multiple IDs added earlier in each plugin's constructor.
      static::$entityIdsToLoad[$entity_id] = $entity_id;
      $entities = $storage->loadMultiple(array_values(static::$entityIdsToLoad));
      $entity = isset($entities[$entity_id]) ? $entities[$entity_id] : NULL;
      static::$entityIdsToLoad = array();
      $entity = $entities[$entity_id] ?? NULL;
      static::$entityIdsToLoad = [];
    }

    if (!$entity) {
      // Fallback to the loading by the UUID.
      if ($uuid = $instance->getDerivativeId()) {
        $loaded_entities = $storage->loadByProperties(array('uuid' => $uuid));
        $loaded_entities = $storage->loadByProperties(['uuid' => $uuid]);
        $entity = reset($loaded_entities);
      }
    }
Loading