public function TablesawSettings::buildForm in Responsive Tables Filter 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/ TablesawSettings.php, line 35
Class
- TablesawSettings
- Configure settings for the Responsive Tables Filter module.
Namespace
Drupal\responsive_tables_filter\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this
->config(static::SETTINGS);
$form['views_enabled'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Automatically add to all table-based Drupal Views and tables generated via theme rendering.'),
'#description' => $this
->t('For more fine-grained control of which Views tables should use the Tablesaw library, leave this unchecked and add the table attributes programmatically. See https://github.com/filamentgroup/tablesaw'),
'#default_value' => $config
->get('views_enabled'),
];
$form['views_tablesaw_mode'] = [
'#type' => 'select',
'#title' => $this
->t('Tablesaw mode'),
'#default_value' => $config
->get('views_tablesaw_mode') ?? 'stack',
'#description' => $this
->t('This will apply to all Views-generated tables on the site. See documentation: https://github.com/filamentgroup/tablesaw'),
'#options' => FilterResponsiveTablesFilter::$modes,
'#states' => [
'visible' => [
':input[name="views_enabled"]' => [
'checked' => TRUE,
],
],
],
];
return parent::buildForm($form, $form_state);
}