Skip to content

Commit

Permalink
Fixing phpcs
Browse files Browse the repository at this point in the history
  • Loading branch information
stankut committed Sep 21, 2023
1 parent f86dfdf commit 291518d
Showing 1 changed file with 34 additions and 3 deletions.
37 changes: 34 additions & 3 deletions modules/os2forms_permissions_by_term/src/Form/SettingsForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@

namespace Drupal\os2forms_permissions_by_term\Form;

use Drupal\Core\Entity\EntityFieldManagerInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\webform\WebformTokenManagerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
* Configure os2web_permissions_by_term settings for this site.
* Configure os2forms_permissions_by_term settings for this site.
*/
class SettingsForm extends ConfigFormBase {

Expand All @@ -17,6 +22,32 @@ class SettingsForm extends ConfigFormBase {
*/
public static $configName = 'os2web_permissions_by_term.settings';

/**
* Entity field manager.
*
* @var \Drupal\Core\Entity\EntityFieldManagerInterface
*/
private $entityFieldTypeManager;

/**
* Constructs an SettingsForm object.
*
* @param \Drupal\Core\Entity\EntityFieldManagerInterface $entity_field_manager
* Entity field manager.
*/
public function __construct(EntityFieldManagerInterface $entity_field_manager) {
$this->entityFieldTypeManager = $entity_field_manager;
}

/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static(
$container->get('entity_field.manager'),
);
}

/**
* {@inheritdoc}
*/
Expand All @@ -35,9 +66,9 @@ protected function getEditableConfigNames() {
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$options = [0 => t('None')];
$options = [0 => $this->t('None')];

$userFields = \Drupal::service('entity_field.manager')->getFieldDefinitions('user', 'user');
$userFields = $this->entityFieldTypeManager->getFieldDefinitions('user', 'user');

/** @var \Drupal\field\Entity\FieldConfig $field */
foreach ($userFields as $field_key => $field) {
Expand Down

0 comments on commit 291518d

Please sign in to comment.