1 entity_layout_context_handler.inc EntityLayoutContext::formValidate($form, &$form_state)

Validate handler for the settings form for this context item.

Overrides LayoutContext::formValidate

File

core/modules/layout/plugins/context/entity_layout_context_handler.inc, line 67
Layout context handler for entities.

Class

EntityLayoutContext
@file Layout context handler for entities.

Code

function formValidate($form, &$form_state) {
  if (empty($form_state['values']['id'])) {
    form_set_error('id', t('An ID is required.'));
  }
  elseif (!entity_load($this->entity_type, $form_state['values']['id'])) {
    $info = entity_get_info($this->entity_type);
    form_set_error('id', t('The selected @entity does not exist.', array('@entity' => $info['label'])));
  }
}