public function SlickGrouping::options_form in Slick Views 7.3
Overrides parent::buildOptionsForm().
Overrides views_plugin_style::options_form
File
- src/
Plugin/ views/ style/ SlickGrouping.php, line 29
Class
- SlickGrouping
- Slick style plugin with grouping support.
Namespace
Drupal\slick_views\Plugin\views\styleCode
public function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
$definition = $this
->getDefinedFormScopes();
$states = [
'visible' => [
'select[name*="[grouping][0][field]"]' => [
'!value' => '',
],
],
];
if (!isset($form['grouping_limit'])) {
$form['grouping_limit'] = [
'#type' => 'textfield',
'#title' => t('Grouping limit'),
'#default_value' => $this->options['grouping_limit'],
'#description' => t('Limit the amount of rows per group. Leave it empty, or 0, for no limit. Applicable only to the first level. Be sure having enough rows.'),
'#enforced' => TRUE,
'#states' => $states,
];
}
if (!isset($form['grouping_optionset'])) {
$form['grouping_optionset'] = [
'#type' => 'select',
'#title' => t('Grouping optionset'),
'#options' => $this
->admin()
->getOptionsetsByGroupOptions('main'),
'#default_value' => $this->options['grouping_optionset'],
'#description' => t('If provided, the grouping header will be treated as Slick tabs and acts like simple filters. Else regular stacking slicks. Requires: Optionset thumbnail, Vanilla unchecked, and Randomize option disabled for all optionsets, else impressing broken grouping due to reordered slides. Combine with grids to have a complete insanity.'),
'#enforced' => TRUE,
'#states' => $states,
];
}
$groupings = $this->options['grouping'] ?: [];
for ($i = 0; $i <= count($groupings); $i++) {
foreach ([
'rendered',
'rendered_strip',
] as $key) {
$form['grouping'][$i][$key]['#field_suffix'] = ' ';
$form['grouping'][$i][$key]['#title_display'] = 'before';
}
}
$this
->buildSettingsForm($form, $definition);
if (isset($form['optionset_thumbnail'])) {
$form['optionset_thumbnail']['#description'] .= ' ' . t('This will be used (taken over) for grouping tabs if Grouping optionset is provided. Including all thumbnail-related options: Skin tthumbnail, Thumbnail position.');
}
}