public function SidrTrigger::blockValidate in Sidr: Accessible Mobile Menus 8
Same name and namespace in other branches
- 8.3 src/Plugin/Block/SidrTrigger.php \Drupal\sidr\Plugin\Block\SidrTrigger::blockValidate()
- 8.2 src/Plugin/Block/SidrTrigger.php \Drupal\sidr\Plugin\Block\SidrTrigger::blockValidate()
Overrides BlockPluginTrait::blockValidate
File
- src/
Plugin/ Block/ SidrTrigger.php, line 259
Class
- SidrTrigger
- Provides a trigger button with Sidr integration.
Namespace
Drupal\sidr\Plugin\BlockCode
public function blockValidate($form, FormStateInterface $form_state) {
parent::blockValidate($form, $form_state);
$values = $form_state
->getValues();
$values = $values['basic'] + $values['advanced'];
// Either trigger text or trigger icon must be set.
if (!$values['trigger_text'] && !$values['trigger_icon']) {
$message = $this
->t('Please provide either trigger text or a trigger icon.');
$form_state
->setError($form['basic']['trigger_text'], $message);
$form_state
->setError($form['advanced']['trigger_icon'], $message);
}
}