function ctools_context_node_edit_form_settings_form_validate

cis7 node_edit_form.inc ctools_context_node_edit_form_settings_form_validate($form, &$form_state)
cle7 node_edit_form.inc ctools_context_node_edit_form_settings_form_validate($form, &$form_state)
elmsmedia7 node_edit_form.inc ctools_context_node_edit_form_settings_form_validate($form, &$form_state)
icor7 node_edit_form.inc ctools_context_node_edit_form_settings_form_validate($form, &$form_state)
meedjum_blog7 node_edit_form.inc ctools_context_node_edit_form_settings_form_validate($form, &$form_state)
mooc7 node_edit_form.inc ctools_context_node_edit_form_settings_form_validate($form, &$form_state)

Validate a node.

File

sites/all/modules/ulmus/ctools/plugins/contexts/node_edit_form.inc, line 128
Plugin to provide a node_edit_form context

Code

function ctools_context_node_edit_form_settings_form_validate($form, &$form_state) {
  // Validate the autocomplete
  if (empty($form_state['values']['nid']) && empty($form_state['values']['node'])) {
    form_error($form['node'], t('You must select a node.'));
    return;
  }

  if (empty($form_state['values']['node'])) {
    return;
  }

  $nid = $form_state['values']['node'];
  $preg_matches = array();
  $match = preg_match('/\[id: (\d+)\]/', $nid, $preg_matches);
  if (!$match) {
    $match = preg_match('/^id: (\d+)/', $nid, $preg_matches);
  }

  if ($match) {
    $nid = $preg_matches[1];
  }
  if (is_numeric($nid)) {
    $node = db_query('SELECT nid, status FROM {node} WHERE nid = :nid', array(':nid' => $nid))->fetchObject();
  }
  else {
    $node = db_query('SELECT nid, status FROM {node} WHERE LOWER(title) = LOWER(:title)', array(':title' => $nid))->fetchObject();
  }

  // Do not allow unpublished nodes to be selected by unprivileged users
  if (!$node || (empty($node->status) && !(user_access('administer nodes')))) {
    form_error($form['node'], t('Invalid node selected.'));
  }
  else {
    form_set_value($form['nid'], $node->nid, $form_state);
  }
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.