You are here

function breakpoints_admin_breakpoint_import_form_validate in Breakpoints 7

Validate a breakpoint import.

File

./breakpoints.admin.inc, line 1005
Breakpoints - admin settings

Code

function breakpoints_admin_breakpoint_import_form_validate($form, &$form_state) {
  ctools_include('export');
  $code = $form_state['values']['import'];
  $breakpoint = ctools_export_crud_import('breakpoints', $code);
  if (!breakpoints_breakpoint_validate($breakpoint)) {
    form_set_error('import', t('Not a valid breakpoint object'));
  }
  else {
    if (breakpoints_breakpoint_machine_name_exists($breakpoint->machine_name)) {
      form_set_error('import', t('A breakpoint with machine name %name already exists', array(
        '%name' => $breakpoint->machine_name,
      )));
    }
    else {
      form_set_value($form['import'], $breakpoint, $form_state);
    }
  }
}