You are here

public function ExternalAdminSettings::buildForm in External New Tab 8

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/ExternalAdminSettings.php, line 56
Contains \Drupal\external\Form\ExternalAdminSettings.

Class

ExternalAdminSettings

Namespace

Drupal\external\Form

Code

public function buildForm(array $form, \Drupal\Core\Form\FormStateInterface $form_state) {
  $form = [];
  $form['external_enabled'] = [
    '#type' => 'checkbox',
    '#title' => t('Enable External Module'),
    '#default_value' => \Drupal::config('external.settings')
      ->get('external_enabled'),
  ];
  $form['external_docs_enabled'] = [
    '#type' => 'checkbox',
    '#title' => t('Open PDFs in new tabs'),
    '#default_value' => \Drupal::config('external.settings')
      ->get('external_docs_enabled'),
  ];
  $form['external_disabled_patterns'] = [
    '#type' => 'textarea',
    '#title' => t('Pages to exclude'),
    '#default_value' => \Drupal::config('external.settings')
      ->get('external_disabled_patterns'),
    '#description' => t("Enter one page per line as Drupal paths. The '*' character is a wildcard. Example paths are %blog for the blog page and %blog-wildcard for every personal blog. %front is the front page.", [
      '%blog' => 'blog',
      '%blog-wildcard' => 'blog/*',
      '%front' => '<front>',
    ]),
  ];
  return parent::buildForm($form, $form_state);
}