'#description' =>
$this->
t('If neither the row nor the style plugin supports fields, this field allows to enable them, so you can for example use groupby.'
),
'#default_value' =>
$this->options
['uses_fields'
],
];
} } /**
* {@inheritdoc}
*/
public function validateOptionsForm(&
$form, FormStateInterface
$form_state) { // Don't run validation on style plugins without the grouping setting.
if ($form_state->
hasValue(['style_options', 'grouping'
])) { // Don't save grouping if no field is specified.
$groupings =
$form_state->
getValue(['style_options', 'grouping'
]);
foreach ($groupings as $index =>
$grouping) { if (empty($grouping['field'
])) { $form_state->
unsetValue(['style_options', 'grouping',
$index]);
} } } } /**
* Alter the options of a display before they are added to the view.
*
* @param array $form
* An associative array containing the structure of the form.
* @param \Drupal\Core\Form\FormStateInterface $form_state
* The current state of the form.
* @param \Drupal\views\Plugin\views\wizard\WizardInterface $wizard
* The current used wizard.
* @param array $display_options
* The options which will be used on the view. The style plugin should
* alter this to its own needs.
* @param string $display_type
* The display type, either block or page.
*/