You are here

public function FilterResponsiveTablesFilter::settingsForm in Responsive Tables Filter 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/FilterResponsiveTablesFilter.php, line 56

Class

FilterResponsiveTablesFilter
Responsive Tables Filter class. Implements process() method only.

Namespace

Drupal\responsive_tables_filter\Plugin\Filter

Code

public function settingsForm(array $form, FormStateInterface $form_state) {
  $form['tablesaw_type'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('Default mode'),
    '#default_value' => $this->settings['tablesaw_type'] ?? 'stack',
    '#description' => $this
      ->t('This will apply by default to tables in WYSIWYGs, but can be overridden on an individual basis by adding the <code>class</code> "tablesaw-stack", "tablesaw-columntoggle", or "tablesaw-swipe" to the <code>table</code> tag. See documentation: https://github.com/filamentgroup/tablesaw'),
    '#options' => self::$modes,
  ];
  $form['tablesaw_persist'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Persistent first column?'),
    '#default_value' => $this->settings['tablesaw_persist'] ?? TRUE,
    '#description' => $this
      ->t('This will apply to all tables in WYSIWYGs.'),
  ];
  return $form;
}