You are here

public function SettingDisableLinkRel::buildForm in Disable link rel 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/SettingDisableLinkRel.php, line 32

Class

SettingDisableLinkRel
Class ImportContactForm.

Namespace

Drupal\disable_link_rel\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('disable_link_rel.import');
  $form['enable'] = [
    '#title' => $this
      ->t('Remove rel link to head'),
    '#type' => 'checkbox',
    '#default_value' => $config
      ->get('enable') ? $config
      ->get('enable') : NULL,
  ];
  $form['links'] = [
    '#title' => $this
      ->t('Enter the values for the attribute to delete'),
    '#type' => 'textarea',
    '#default_value' => $config
      ->get('links') ? $config
      ->get('links') : '',
    '#description' => $this
      ->t('Enter the attributes separated by commas. Example: <i>canonical, shortlink, delete-form</i>'),
  ];
  $form['remove_link_attr'] = [
    '#title' => $this
      ->t('Remove attributes from links'),
    '#type' => 'checkbox',
    '#default_value' => $config
      ->get('remove_link_attr') ? $config
      ->get('remove_link_attr') : NULL,
  ];
  $form['remove_link_attr_list'] = [
    '#title' => $this
      ->t('Enter attributes to delete'),
    '#type' => 'textarea',
    '#default_value' => $config
      ->get('remove_link_attr_list') ? $config
      ->get('remove_link_attr_list') : '',
    '#description' => $this
      ->t('Enter the attributes separated by commas. Example: <i>data-drupal-link-system-path, system-path</i>'),
  ];
  $form['cach_clear'] = [
    '#title' => $this
      ->t('Clear cache when saving settings'),
    '#type' => 'checkbox',
    '#default_value' => TRUE,
  ];
  return parent::buildForm($form, $form_state);
}