You are here

public function ObfuscateEmail::settingsForm in Obfuscate Email 8

Generates a filter's settings form.

Parameters

array $form: A minimally prepopulated form array.

\Drupal\Core\Form\FormStateInterface $form_state: The state of the (entire) configuration form.

Return value

array The $form array with additional form elements for the settings of this filter. The submitted form values should match $this->settings.

Overrides FilterBase::settingsForm

File

src/Plugin/Filter/ObfuscateEmail.php, line 29

Class

ObfuscateEmail
Provide a filter to obfuscate mailto anchor tags and optionally replace inner text.

Namespace

Drupal\obfuscate_email\Plugin\Filter

Code

public function settingsForm(array $form, FormStateInterface $form_state) {
  $form['click'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Force user to click link to display mail address.'),
    '#default_value' => $this->settings['click'],
  ];
  $form['click_label'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Text to show on link'),
    '#default_value' => $this->settings['click_label'],
    '#states' => [
      'visible' => [
        ':input[name="filters[obfuscate_email][settings][click]"]' => array(
          'checked' => TRUE,
        ),
      ],
    ],
  ];
  return $form;
}