diff --git a/src/Entity/UserType.php b/src/Entity/UserType.php index fb4cb30..541a194 100644 --- a/src/Entity/UserType.php +++ b/src/Entity/UserType.php @@ -74,7 +74,7 @@ class UserType extends ConfigEntityBundleBase implements UserTypeInterface { */ public function isLocked() { $locked = \Drupal::state()->get('user.type.locked'); - return isset($locked[$this->id()]) ? $locked[$this->id()] : FALSE; + return $locked[$this->id()] ?? FALSE; } /** diff --git a/src/UserTypeForm.php b/src/UserTypeForm.php index eb3a9c2..2de8c1d 100644 --- a/src/UserTypeForm.php +++ b/src/UserTypeForm.php @@ -22,10 +22,10 @@ class UserTypeForm extends BundleEntityFormBase { $form['#title'] = ($this->operation == 'add') ? $this->t('Add account type') : $this->t('Edit %label account type', ['%label' => $this->entity->label()]); $form['label'] = [ - '#title' => t('Name'), + '#title' => $this->t('Name'), '#type' => 'textfield', '#default_value' => $type->label(), - '#description' => t('The human-readable name of this account type.'), + '#description' => $this->t('The human-readable name of this account type.'), '#required' => TRUE, '#size' => 30, ]; @@ -39,22 +39,22 @@ class UserTypeForm extends BundleEntityFormBase { 'exists' => ['Drupal\user_bundle\Entity\UserType', 'load'], 'source' => ['label'], ], - '#description' => t('A unique machine-readable name for this account type. It must only contain lowercase letters, numbers, and underscores. This name will be used for constructing the URL of the %user-add page, in which underscores will be converted into hyphens.', [ - '%user-add' => t('Add user'), + '#description' => $this->t('A unique machine-readable name for this account type. It must only contain lowercase letters, numbers, and underscores. This name will be used for constructing the URL of the %user-add page, in which underscores will be converted into hyphens.', [ + '%user-add' => $this->t('Add user'), ]), ]; $form['description'] = [ - '#title' => t('Description'), + '#title' => $this->t('Description'), '#type' => 'textarea', '#default_value' => $type->getDescription(), - '#description' => t('This text will be displayed under this account type on the Add new user page.'), + '#description' => $this->t('This text will be displayed under this account type on the Add new user page.'), ]; if ($this->moduleHandler->moduleExists('language')) { $form['language'] = [ '#type' => 'details', - '#title' => t('Language settings'), + '#title' => $this->t('Language settings'), ]; $language_configuration = ContentLanguageSettings::loadByEntityTypeBundle('user', $type->id()); @@ -76,8 +76,8 @@ class UserTypeForm extends BundleEntityFormBase { */ protected function actions(array $form, FormStateInterface $form_state) { $actions = parent::actions($form, $form_state); - $actions['submit']['#value'] = t('Save account type'); - $actions['delete']['#value'] = t('Delete account type'); + $actions['submit']['#value'] = $this->t('Save account type'); + $actions['delete']['#value'] = $this->t('Delete account type'); return $actions; } diff --git a/src/UserTypeListBuilder.php b/src/UserTypeListBuilder.php index d34c5a5..4d64388 100644 --- a/src/UserTypeListBuilder.php +++ b/src/UserTypeListBuilder.php @@ -17,9 +17,9 @@ class UserTypeListBuilder extends ConfigEntityListBuilder { * {@inheritdoc} */ public function buildHeader() { - $header['title'] = t('Name'); + $header['title'] = $this->t('Name'); $header['description'] = [ - 'data' => t('Description'), + 'data' => $this->t('Description'), 'class' => [RESPONSIVE_PRIORITY_MEDIUM], ]; return $header + parent::buildHeader(); diff --git a/user_bundle.module b/user_bundle.module index 9150af4..21d5556 100644 --- a/user_bundle.module +++ b/user_bundle.module @@ -1,5 +1,10 @@