You are here

function template_preprocess_page_manager_edit_page in Chaos Tool Suite (ctools) 6

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

Preprocess the page manager edit page.

File

page_manager/theme/page_manager.theme.inc, line 12
Preprocess functions for page manager editing templates.

Code

function template_preprocess_page_manager_edit_page(&$vars) {
  ctools_include('ajax');
  ctools_include('modal');
  ctools_modal_add_js();
  ctools_add_js('dependent');
  drupal_add_css(drupal_get_path('module', 'page_manager') . '/css/page-manager.css');
  ctools_add_css('wizard');
  $task = $vars['page']->task;
  $task_handler_plugins = page_manager_get_task_handler_plugins($task);
  foreach ($task_handler_plugins as $id => $plugin) {
    if (isset($plugin['admin css'])) {
      foreach ($plugin['admin css'] as $file) {
        drupal_add_css($file);
      }
    }
    if (isset($plugin['admin js'])) {
      foreach ($plugin['admin js'] as $file) {
        drupal_add_js($file);
      }
    }
  }
  $page =& $vars['page'];
  $vars['locked'] = '';
  $vars['changed'] = '';
  if (!empty($page->locked)) {
    $vars['locked'] = theme('page_manager_lock', $page);
    $vars['changed'] = theme('page_manager_changed', t('Locked'), t('This page is being edited by another user and you cannot make changes to it.'));
  }
  else {
    if (!empty($page->new)) {
      $vars['changed'] = theme('page_manager_changed', t('New'), t('This page is newly created and has not yet been saved to the database. It will not be available until you save it.'));
    }
    else {
      if (!empty($page->changed)) {
        $vars['changed'] = theme('page_manager_changed', t('Changed'), t('This page has been modified, but these modifications are not yet live. While modifying this page, it is locked from modification by other users.'));
      }
    }
  }
  $form_state = array(
    'page' => &$vars['page'],
  );
  $active = $vars['content']['active'];
  if ($active[0] == 'handlers' && isset($vars['operations'][$active[1]])) {
    $vars['operations']['secondary'] = $vars['operations'][$active[1]];
  }
}