You are here

public function FilterResponsiveWrappers::settingsForm in Responsive wrappers 8

Same name and namespace in other branches
  1. 2.0.x src/Plugin/Filter/FilterResponsiveWrappers.php \Drupal\responsivewrappers\Plugin\Filter\FilterResponsiveWrappers::settingsForm()

Implements settings filter form.

Overrides FilterBase::settingsForm

File

src/Plugin/Filter/FilterResponsiveWrappers.php, line 124

Class

FilterResponsiveWrappers
Check the content and add responsive classes and wrappers.

Namespace

Drupal\responsivewrappers\Plugin\Filter

Code

public function settingsForm(array $form, FormStateInterface $form_state) {
  $form['responsive_iframe'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Responsive video'),
    '#default_value' => isset($this->settings['responsive_iframe']) ? $this->settings['responsive_iframe'] : '',
    '#description' => $this
      ->t('Add responsive wrapper for videos (16/9 aspect ratio).'),
  ];
  $form['responsive_iframe_pattern'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Source video pattern detection'),
    '#default_value' => isset($this->settings['responsive_iframe_pattern']) ? $this->settings['responsive_iframe_pattern'] : '#.*(youtube.|vimeo.).*#ui',
    '#description' => $this
      ->t('Regular expresion for source video detection. This pattern evaluates scr iframe attribute.'),
  ];
  $form['responsive_table'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Responsive tables'),
    '#default_value' => isset($this->settings['responsive_table']) ? $this->settings['responsive_table'] : '',
    '#description' => $this
      ->t('Add responsive wrapper for tables.'),
  ];
  $form['responsive_image'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Responsive images'),
    '#default_value' => isset($this->settings['responsive_image']) ? $this->settings['responsive_image'] : '',
    '#description' => $this
      ->t('Add responsive class for images.'),
  ];
  return $form;
}