Commit f6ed3ab3 authored by Qiangjun Ran's avatar Qiangjun Ran Committed by Qiangjun Ran
Browse files

Issue #3236465 by jungle, timodwhit, alison: Improve issue 3145629 -- coding standards further

parent 798fe1a0
Loading
Loading
Loading
Loading
+9 −4
Changes for src/Form/ConfigForm.php: 9 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@

namespace Drupal\nodeaccess\Form;

use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Component\Utility\Html;
@@ -16,17 +17,20 @@ class ConfigForm extends ConfigFormBase {
  /**
   * The entity type manager.
   *
   * @var Drupal\Core\Entity\EntityTypeManagerInterface
   * @var \Drupal\Core\Entity\EntityTypeManagerInterface
   */
  protected $entityTypeManager;

  /**
   * Constructs a grants form object.
   *
   * @param Drupal\Core\Entity\EntityTypeManagerInterface $entitytype_manager
   * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
   *   The config factory.
   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entitytype_manager
   *   The entity type manager.
   */
  public function __construct(EntityTypeManagerInterface $entitytype_manager) {
  public function __construct(ConfigFactoryInterface $config_factory, EntityTypeManagerInterface $entitytype_manager) {
    parent::__construct($config_factory);
    $this->entityTypeManager = $entitytype_manager;
  }

@@ -35,7 +39,8 @@ class ConfigForm extends ConfigFormBase {
   */
  public static function create(ContainerInterface $container) {
    return new static(
      $container->get('entity_type.manager'),
      $container->get('config.factory'),
      $container->get('entity_type.manager')
    );
  }

+11 −10
Changes for src/Form/GrantsForm.php: 11 added lines, 10 removed lines.
Original line number Diff line number Diff line
@@ -24,50 +24,50 @@ class GrantsForm extends FormBase {
  /**
   * The current database.
   *
   * @var Drupal\Core\Database\Connection
   * @var \Drupal\Core\Database\Connection
   */
  protected $database;

  /**
   * The configuration factory.
   *
   * @var Drupal\Core\Config\ConfigFactoryInterface
   * @var \Drupal\Core\Config\ConfigFactoryInterface
   */
  protected $configFactory;

  /**
   * The entity type manager.
   *
   * @var Drupal\Core\Entity\EntityTypeManagerInterface
   * @var \Drupal\Core\Entity\EntityTypeManagerInterface
   */
  protected $entityTypeManager;

  /**
   * The node grant storage.
   *
   * @var Drupal\node\NodeGrantDatabaseStorageInterface
   * @var \Drupal\node\NodeGrantDatabaseStorageInterface
   */
  protected $nodeGrantStorage;

  /**
   * The messenger.
   *
   * @var Drupal\Core\Messenger\MessengerInterface
   * @var \Drupal\Core\Messenger\MessengerInterface
   */
  protected $messenger;

  /**
   * Constructs a grants form object.
   *
   * @param Drupal\Core\Database\Connection $database
   * @param \Drupal\Core\Database\Connection $database
   *   The database.
   * @param Drupal\Core\Config\ConfigFactoryInterface $configfactory
   * @param \Drupal\Core\Config\ConfigFactoryInterface $configfactory
   *   The configuration factory.
   * @param Drupal\Core\Entity\EntityTypeManagerInterface $entitytype_manager
   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entitytype_manager
   *   The entity type manager.
   * @param Drupal\node\NodeGrantDatabaseStorageInterface $nodegrant_storage
   * @param \Drupal\node\NodeGrantDatabaseStorageInterface $nodegrant_storage
   *   The node grant storage.
   * @param Drupal\Core\Messenger\MessengerInterface $messenger
   * @param \Drupal\Core\Messenger\MessengerInterface $messenger
   *   The messenger.
   */
  public function __construct(Connection $database, ConfigFactoryInterface $configfactory, EntityTypeManagerInterface $entitytype_manager, NodeGrantDatabaseStorageInterface $nodegrant_storage, MessengerInterface $messenger) {
@@ -388,6 +388,7 @@ class GrantsForm extends FormBase {
    $values = $form_state->getValues();
    $nid = $values['nid'];
    $grants = [];
    /** @var \Drupal\node\Entity\Node $node */
    $node = $this->entityTypeManager->getStorage('node')->load($nid);

    foreach (['uid', 'rid'] as $type) {