You are here

function page_manager_handler_import_validate in Chaos Tool Suite (ctools) 6

Same name and namespace in other branches
  1. 7 page_manager/page_manager.admin.inc \page_manager_handler_import_validate()

Make sure that an import actually provides a handler.

File

page_manager/page_manager.admin.inc, line 1448
Administrative functions for the page manager.

Code

function page_manager_handler_import_validate($form, &$form_state) {
  if (!user_access('use PHP for block visibility')) {
    form_error($form['shoveoff'], t('You account permissions do not permit you to import.'));
    return;
  }
  ob_start();
  eval($form_state['values']['object']);
  ob_end_clean();
  if (empty($handler)) {
    $errors = ob_get_contents();
    if (empty($errors)) {
      $errors = t('No variant found.');
    }
    form_error($form['object'], t('Unable to get a variant from the import. Errors reported: @errors', array(
      '@errors' => $errors,
    )));
  }
  $form_state['handler'] = $handler;
}