You are here

function mediafront_preset_import_validate in MediaFront 7

Same name and namespace in other branches
  1. 6.2 includes/mediafront.preset.inc \mediafront_preset_import_validate()
  2. 6 includes/mediafront.preset.inc \mediafront_preset_import_validate()
  3. 7.2 includes/mediafront.preset.inc \mediafront_preset_import_validate()

Validation for the preset import form.

1 string reference to 'mediafront_preset_import_validate'
mediafront_preset_import_form in includes/mediafront.preset.inc
Import's a preset.

File

includes/mediafront.preset.inc, line 432

Code

function mediafront_preset_import_validate($form, &$form_state) {
  $preset = '';

  // Get the preset that they declared in the text field.
  ob_start();
  eval($form_state['values']['preset']);
  ob_end_clean();
  if (is_array($preset)) {
    $name = isset($preset['name']) ? $preset['name'] : '';
    if ($error = mediafront_validate_preset_name($name)) {
      form_set_error('name', $error);
    }
  }
  else {
    form_set_error('name', 'Invalid preset import.');
  }
  $form_state['preset'] =& $preset;
}