public function Cycle::validateConfigurationForm in Views Slideshow 8.4
Form validation handler.
Parameters
array $form: An associative array containing the structure of the plugin form as built by static::buildConfigurationForm().
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form. Calling code should pass on a subform state created through \Drupal\Core\Form\SubformState::createForSubform().
Overrides ViewsSlideshowTypeBase::validateConfigurationForm
File
- modules/
views_slideshow_cycle/ src/ Plugin/ ViewsSlideshowType/ Cycle.php, line 550
Class
- Cycle
- Provides a slideshow type based on jquery cycle.
Namespace
Drupal\views_slideshow_cycle\Plugin\ViewsSlideshowTypeCode
public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
$values = $form_state
->getValue([
'style_options',
'views_slideshow_cycle',
]);
if (!is_numeric($values['timeout'])) {
$form_state
->setErrorByName('style_options][views_slideshow_cycle][timeout', $this
->t('@setting must be numeric!', [
'@setting' => $this
->t('Timeout'),
]));
}
if (!is_numeric($values['speed'])) {
$form_state
->setErrorByName('style_options][views_slideshow_cycle][speed', $this
->t('@setting must be numeric!', [
'@setting' => $this
->t('Speed'),
]));
}
if (!is_numeric($values['remember_slide_days'])) {
$form_state
->setErrorByName('style_options][views_slideshow_cycle][remember_slide_days', $this
->t('@setting must be numeric!', [
'@setting' => $this
->t('Slide days'),
]));
}
}