You are here

public function TableFilter::settingsForm in Bootstrap Utilities - Text editor filters 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/TableFilter.php, line 32

Class

TableFilter
Add Bootstrap class to any tables.

Namespace

Drupal\bootstrap_utilities\Plugin\Filter

Code

public function settingsForm(array $form, FormStateInterface $form_state) {
  $form['table_remove_width_height'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Remove <code>width</code> and <code>height</code> attributes from table cells.'),
    '#default_value' => $this->settings['table_remove_width_height'],
  ];
  $form['table_row_striping'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Striped rows'),
    '#default_value' => $this->settings['table_row_striping'],
    '#description' => $this
      ->t('Adds <code>.table-striped</code> to add zebra-striping to any table row within the <code>&lt;tbody&gt;</code>.'),
  ];
  $form['table_bordered'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Bordered table'),
    '#default_value' => $this->settings['table_bordered'],
    '#description' => $this
      ->t('Adds <code>.table-bordered</code> for borders on all sides of the table and cells.'),
  ];
  $form['table_row_hover'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Hoverable rows'),
    '#default_value' => $this->settings['table_row_hover'],
    '#description' => $this
      ->t('Adds <code>.table-hover</code> to enable a hover state on table rows within a <code>&lt;tbody&gt;</code>.'),
  ];
  $form['table_small'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Small table'),
    '#default_value' => $this->settings['table_small'],
    '#description' => $this
      ->t('Adds <code>.table-sm</code> to make tables more compact by cutting cell padding in half.'),
  ];
  return $form;
}