You are here

public function ConfigForm::buildForm in Menu Item Role Access 8

Same name and namespace in other branches
  1. 8.2 src/Form/ConfigForm.php \Drupal\menu_item_role_access\Form\ConfigForm::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/ConfigForm.php, line 32

Class

ConfigForm
Class ConfigForm.

Namespace

Drupal\menu_item_role_access\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('menu_item_role_access.config');
  $form['overwrite_internal_link_target_access'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Overwrite internal link target access check'),
    '#description' => $this
      ->t("When this option is checked, this module will ignore the access check of the menu target. For example: when a user does not have access to a node he will not see the menu item for this node. With this option checked the user will be able to see the menu item, but only if the user's role is allowed."),
    '#default_value' => $config
      ->get('overwrite_internal_link_target_access'),
  ];
  $form['inherit_parent_access'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Allow parents to override children'),
    '#description' => $this
      ->t('Allow children items to inherit the menu item access of their parents.'),
    '#default_value' => $config
      ->get('inherit_parent_access'),
  ];
  return parent::buildForm($form, $form_state);
}