You are here

public function SettingsForm::buildForm in Permissions by Term 8

Same name and namespace in other branches
  1. 8.2 src/Form/SettingsForm.php \Drupal\permissions_by_term\Form\SettingsForm::buildForm()

Form constructor.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The form structure.

Overrides ConfigFormBase::buildForm

File

src/Form/SettingsForm.php, line 30

Class

SettingsForm

Namespace

Drupal\permissions_by_term\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $form = parent::buildForm($form, $form_state);
  $description = <<<EOT
By default users are granted access content, as long they have access to a <strong>single</strong>
related taxonomy term. If the single term restriction option is checked, they must
have access to <strong>all</strong> related taxonomy terms to access an node.
EOT;
  $form['single_term_restriction'] = [
    '#type' => 'checkbox',
    '#title' => t('Single Term Restriction'),
    '#description' => t($description),
    '#default_value' => \Drupal::config('permissions_by_term.settings.single_term_restriction')
      ->get('value'),
  ];
  return parent::buildForm($form, $form_state);
}