You are here

function workflow_add_form_validate in Workflow 5.2

Same name and namespace in other branches
  1. 5 workflow.module \workflow_add_form_validate()

File

./workflow.module, line 883

Code

function workflow_add_form_validate($form_id, $form_values) {
  $workflow_name = $form_values['wf_name'];
  $workflows = array_flip(workflow_get_all());

  // Make sure a nonblank workflow name is provided.
  if ($workflow_name == '') {
    form_set_error('wf_name', t('Please provide a nonblank name for the new workflow.'));
  }

  // Make sure workflow name is not a duplicate.
  if (array_key_exists($workflow_name, $workflows)) {
    form_set_error('wf_name', t('A workflow with the name %name already exists. Please enter another name for your new workflow.', array(
      '%name' => $workflow_name,
    )));
  }
}