public function ShortcutFormController::validate

Overrides \Drupal\Core\Entity\EntityFormController::validate().

Overrides EntityFormController::validate

File

drupal/core/modules/shortcut/lib/Drupal/shortcut/ShortcutFormController.php, line 63
Contains \Drupal\shortcut\ShortcutFormController.

Class

ShortcutFormController
Form controller for the shortcut set entity edit forms.

Namespace

Drupal\shortcut

Code

public function validate(array $form, array &$form_state) {
  parent::validate($form, $form_state);
  $entity = $this->entity;

  // Check to prevent a duplicate title.
  if ($form_state['values']['label'] != $entity
    ->label() && shortcut_set_title_exists($form_state['values']['label'])) {
    form_set_error('label', t('The shortcut set %name already exists. Choose another name.', array(
      '%name' => $form_state['values']['label'],
    )));
  }
}