function SwitchShortcutSet::validateForm
Overrides FormBase::validateForm
File
-
core/
modules/ shortcut/ src/ Form/ SwitchShortcutSet.php, line 160
Class
- SwitchShortcutSet
- Builds the shortcut set switch form.
Namespace
Drupal\shortcut\FormCode
public function validateForm(array &$form, FormStateInterface $form_state) {
if ($form_state->getValue('set') == 'new') {
// Check to prevent creating a shortcut set with an empty title.
if (trim($form_state->getValue('label')) == '') {
$form_state->setErrorByName('label', $this->t('The new set label is required.'));
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.