You are here

function bean_form_validate in Bean (for Drupal 7) 7

Validation for bean form

1 string reference to 'bean_form_validate'
bean_form in includes/bean.pages.inc
Bean form

File

includes/bean.pages.inc, line 349
Bean Functions

Code

function bean_form_validate($form, &$form_state) {
  $bean = $form_state['values']['bean'];
  $bean->label = $form_state['values']['label'];
  $bean->title = $form_state['values']['title'];
  $bean->view_mode = $form_state['values']['view_mode'];
  $bean->is_new_revision = $form_state['values']['is_new_revision'];

  // Avoid dataloss.
  if (empty($form_state['values']['is_new_revision'])) {
    $bean->default_revision = TRUE;
  }
  else {
    $bean->default_revision = $form_state['values']['default_revision'];
  }
  if ($bean->is_new_revision) {
    $bean->log = $form_state['values']['log'];
  }
  if (function_exists('entity_language')) {
    $langcode = entity_language('bean', $bean);
  }
  else {
    $langcode = NULL;
  }
  field_attach_form_validate('bean', $bean, $form, $form_state);
  $form_state['values']['bean'] = $bean;
  $bean
    ->validate($form_state['values'], $form_state);
}