function chado_add_admin_form_set_title_form_validate

2.x tripal_core.chado_nodes.title_and_path.api.inc chado_add_admin_form_set_title_form_validate($form, $form_state)
3.x tripal_core.chado_nodes.title_and_path.inc chado_add_admin_form_set_title_form_validate($form, $form_state)

Implements hook_form_validate(). VALIDATE: validate the format.

1 string reference to 'chado_add_admin_form_set_title_form_validate'
chado_add_admin_form_set_title in tripal_core/api/tripal_core.chado_nodes.title_and_path.api.inc
Generic "Set Node Title" sub-form for setting the title of any chado node

File

tripal_core/api/tripal_core.chado_nodes.title_and_path.api.inc, line 360
Contains API functions to set titles and paths for all chado nodes

Code

function chado_add_admin_form_set_title_form_validate($form, $form_state) {

  // Ensure that all tokens used in the format are in the tokens list
  if (preg_match_all('/\[[^]]+\]/', $form_state['values']['custom_title'], $used_tokens)) {
    $token_list = unserialize($form_state['values']['tokens']);
    foreach ($used_tokens[0] as $token) {
      if (!array_key_exists($token, $token_list)) {
        form_set_error('custom_title', 'All tokens used must be in the "Available Tokens" list. Please make sure not to use [ or ] unless it\'s denoting a token');
      }
    }
  }

}