Commit 9f6c7773 authored by Florent Torregrosa's avatar Florent Torregrosa Committed by Florent Torregrosa
Browse files

Issue #3258955 by Grimreaper: Fix Coding standards.

parent f6e3c3ce
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@ use Symfony\Component\HttpFoundation\Session\SessionInterface;
/**
 * Handle access data in session.
 */
class SessionBackend implements AccessStorageInterface, AccessCheckerInterface {
class SessionBackend implements AccessCheckerInterface, AccessStorageInterface {

  /**
   * Root session key for all session data.
+13 −12
Original line number Diff line number Diff line
@@ -120,11 +120,12 @@ abstract class UserDataEditFormBase extends FormBase {
    }

    // Access granting.
    /** @var string $grant_area */
    $grant_area = $form_state->getValue('grant_area');
    $grant_list = explode(',', str_replace(["\r", "\n"], ',', $grant_area));
    $grant_list = \explode(',', \str_replace(["\r", "\n"], ',', $grant_area));
    $user_storage = $this->entityTypeManager->getStorage('user');
    foreach ($grant_list as $user_name_or_email) {
      $user_name_or_email = trim($user_name_or_email);
      $user_name_or_email = \trim($user_name_or_email);
      if (empty($user_name_or_email)) {
        continue;
      }
@@ -141,7 +142,7 @@ abstract class UserDataEditFormBase extends FormBase {
        continue;
      }

      $grant_user_id = array_shift($grant_user_ids);
      $grant_user_id = (int) \array_shift($grant_user_ids);
      $this->userData->set(UserDataBackend::MODULE_NAME, $grant_user_id, $build_info['user_data_name'], TRUE);
    }
  }
@@ -167,7 +168,7 @@ abstract class UserDataEditFormBase extends FormBase {
    /** @var array $entity_access */
    $entity_access = $this->userData->get(UserDataBackend::MODULE_NAME, NULL, $name);

    $uids = array_keys($entity_access);
    $uids = \array_keys($entity_access);

    /** @var \Drupal\user\UserInterface[] $users */
    $users = $this->entityTypeManager->getStorage('user')->loadMultiple($uids);
@@ -191,7 +192,7 @@ abstract class UserDataEditFormBase extends FormBase {
    $option = (string) $user->getDisplayName();
    $email = $user->getEmail();
    if ($email != NULL) {
      $option .= " ($email)";
      $option .= " ({$email})";
    }
    return $option;
  }
+12 −8
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
 * Manipulates entity type information.
 */
class EntityTypeInfo implements ContainerInjectionInterface {

  use StringTranslationTrait;

  /**
@@ -30,6 +29,11 @@ class EntityTypeInfo implements ContainerInjectionInterface {
   */
  public const ENTITY_OPERATION = 'entity_access_password_user_data_edit';

  /**
   * The entity operation weight.
   */
  public const ENTITY_OPERATION_WEIGHT = 50;

  /**
   * The current user.
   *
@@ -70,9 +74,9 @@ class EntityTypeInfo implements ContainerInjectionInterface {
  public function entityOperation(EntityInterface $entity): array {
    $operations = [];
    if (
      $entity instanceof FieldableEntityInterface &&
      $this->currentUser->hasPermission(self::ACCESS_PERMISSION) &&
      $entity->access('update')
      $entity instanceof FieldableEntityInterface
      && $this->currentUser->hasPermission(self::ACCESS_PERMISSION)
      && $entity->access('update')
    ) {
      $fields = $entity->getFields();
      foreach ($fields as $field) {
@@ -80,13 +84,13 @@ class EntityTypeInfo implements ContainerInjectionInterface {
        if ($field_definition->getType() == 'entity_access_password_password') {
          $entity_type_id = $entity->getEntityTypeId();
          $bundle_id = $entity->bundle();
          $route_name = sprintf(EntityFormRoutes::ROUTE_NAME, $entity_type_id, $bundle_id);
          $route_name = \sprintf(EntityFormRoutes::ROUTE_NAME, $entity_type_id, $bundle_id);
          $operations[self::ENTITY_OPERATION] = [
            'title' => $this->t('Password access user data'),
            'url' => URL::fromRoute($route_name, [
              $entity_type_id => $entity->id(),
            ]),
            'weight' => 50,
            'weight' => self::ENTITY_OPERATION_WEIGHT,
          ];
          break;
        }
+2 −2
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ class UserDataBackendBundleLocalTask extends UserDataBackendDeriverBase {
      /** @var \Drupal\Core\Entity\EntityTypeInterface $entity_type */
      $entity_type = $entity_infos['entity_type'];
      foreach ($entity_infos['bundles'] as $bundle_id => $bundle_infos) {
        $route_name = sprintf(BundleFormRoutes::ROUTE_NAME, $entity_type_id, $bundle_id);
        $route_name = \sprintf(BundleFormRoutes::ROUTE_NAME, $entity_type_id, $bundle_id);
        $this->derivatives[$route_name] = [
          'title' => $this->t('@entity_type: @bundle', [
            '@entity_type' => $entity_type->getLabel(),
+2 −2
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ class UserDataBackendBundleMenuLink extends UserDataBackendDeriverBase {
      /** @var \Drupal\Core\Entity\EntityTypeInterface $entity_type */
      $entity_type = $entity_infos['entity_type'];
      foreach ($entity_infos['bundles'] as $bundle_id => $bundle_infos) {
        $route_name = sprintf(BundleFormRoutes::ROUTE_NAME, $entity_type_id, $bundle_id);
        $route_name = \sprintf(BundleFormRoutes::ROUTE_NAME, $entity_type_id, $bundle_id);
        $this->derivatives[$route_name] = [
          'title' => $this->t('@entity_type: @bundle', [
            '@entity_type' => $entity_type->getLabel(),
Loading