You are here

public function RenameAdminPathsSettingsForm::buildForm in Rename Admin Paths 8.2

Same name and namespace in other branches
  1. 8 src/Form/RenameAdminPathsSettingsForm.php \Drupal\rename_admin_paths\Form\RenameAdminPathsSettingsForm::buildForm()

.

Overrides ConfigFormBase::buildForm

File

src/Form/RenameAdminPathsSettingsForm.php, line 75

Class

RenameAdminPathsSettingsForm

Namespace

Drupal\rename_admin_paths\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $form['admin_path'] = [
    '#type' => 'fieldset',
    '#title' => $this
      ->t('Rename admin path'),
  ];
  $form['admin_path']['admin_path'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Rename admin path'),
    '#default_value' => $this->config
      ->isPathEnabled('admin'),
    '#description' => $this
      ->t('If checked, "admin" will be replaced by the following term in admin path.'),
  ];
  $form['admin_path']['admin_path_value'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Replace "admin" in admin path by'),
    '#default_value' => $this->config
      ->getPathValue('admin'),
    '#description' => $this
      ->t('This value will replace "admin" in admin path.'),
    '#element_validate' => [
      [
        $this,
        'validate',
      ],
    ],
  ];
  $form['user_path'] = [
    '#type' => 'fieldset',
    '#title' => $this
      ->t('Rename user path'),
  ];
  $form['user_path']['user_path'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Rename user path'),
    '#default_value' => $this->config
      ->isPathEnabled('user'),
    '#description' => $this
      ->t('If checked, "user" will be replaced by the following term in user path.'),
  ];
  $form['user_path']['user_path_value'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Replace "user" in user path by'),
    '#default_value' => $this->config
      ->getPathValue('user'),
    '#description' => $this
      ->t('This value will replace "user" in user path.'),
    '#element_validate' => [
      [
        $this,
        'validate',
      ],
    ],
  ];
  return parent::buildForm($form, $form_state);
}