You are here

function views_deploy_add_form_validate in Deploy - Content Staging 6

Same name and namespace in other branches
  1. 5 views_deploy/views_deploy.module \views_deploy_add_form_validate()

Validation callback for views_deploy_add_form().

@todo Might want to make this a little more graceful.

File

modules/views_deploy/views_deploy.pages.inc, line 73
Page handlers for content type deployment pages.

Code

function views_deploy_add_form_validate($form, &$form_state) {

  // Check and see if any of these views are already in the plan, if
  // so error out.
  foreach ($form_state['values']['view_name'] as $view_name) {
    $result = db_query("SELECT iid FROM {deploy_plan_items} WHERE module = 'views' AND pid = %d AND data = '%s'", $form_state['values']['pid'], $view_name);
    if (db_result($result)) {
      form_set_error('view_name', t("View {$view_name} already exists in the deployment plan."));
    }
  }
}