1 entity_id_layout_access.inc EntityIDLayoutAccess::formValidate($form, &$form_state)

Validate handler for the settings form for this access item.

Overrides LayoutAccess::formValidate

File

core/modules/layout/plugins/access/entity_id_layout_access.inc, line 55
Plugin to provide access control based upon entity ID.

Class

EntityIDLayoutAccess
@file Plugin to provide access control based upon entity ID.

Code

function formValidate($form, &$form_state) {
  parent::formValidate($form, $form_state);

  $entity_id = $form_state['values']['entity_id'];
  if (is_numeric($entity_id) && round($entity_id) == $entity_id && $entity_id >= 1) {
    $entity = entity_load($this->entity_type, $entity_id);
    if (!$entity) {
      $label = $this->entity_info['label'];
      form_set_error('entity_id', t('There is no @label with ID @entity_id.', array(
        '@label' => $label,
        '@entity_id' => $entity_id,
      )));
    }
  }
}