You are here

function skinr_ui_import_form_validate in Skinr 7.2

Same name and namespace in other branches
  1. 6.2 skinr_ui.admin.inc \skinr_ui_import_form_validate()

Form validation handler for skinr_ui_import_form().

File

./skinr_ui.admin.inc, line 1073
Admin page callbacks for the Skinr UI module.

Code

function skinr_ui_import_form_validate(&$form, &$form_state) {
  if (empty($form_state['values']['skinr_skins'])) {

    // Error.
    form_error($form['skinr_skins'], t('These are not valid skin configurations.'));
    return;
  }
  $skins = '';
  ob_start();
  eval($form_state['values']['skinr_skins']);
  ob_end_clean();
  foreach ($skins as $key => $skin) {
    if (!is_object($skin) || !skinr_skin_validate($skins[$key])) {
      form_error($form['skinr_skins'], t('These are not valid skin configurations.'));
      return;
    }
  }
  $form_state['skins'] =& $skins;
}