You are here

function template_preprocess_panels_dashboard in Panels 6.3

Same name and namespace in other branches
  1. 7.3 includes/callbacks.inc \template_preprocess_panels_dashboard()

File

includes/callbacks.inc, line 85
callbacks.inc Minor menu callbacks for Panels helpers.

Code

function template_preprocess_panels_dashboard(&$vars) {
  ctools_add_css('panels-dashboard', 'panels');
  ctools_include('plugins');
  $vars['image_path'] = ctools_image_path('', 'panels');
  $vars['links'] = array();
  $vars['blocks'] = array();
  foreach (module_implements('panels_dashboard_blocks') as $module) {
    $function = $module . '_panels_dashboard_blocks';
    $function($vars);
  }

  // Add in any default links for modules that are not active
  panels_dashboard_final_blocks($vars);

  // If page manager module is enabled, add a very low eight block to
  // list the page wizards.
  if (module_exists('page_manager')) {
    $vars['blocks']['wizards'] = array(
      'weight' => -101,
      'section' => 'right',
      'title' => t('Page wizards'),
      'content' => '',
      'class' => 'dashboard-wizards',
    );
    ctools_include('page-wizard');
    $plugins = page_manager_get_page_wizards();
    uasort($plugins, 'ctools_plugin_sort');
    foreach ($plugins as $id => $plugin) {
      if (isset($plugin['type']) && $plugin['type'] == 'panels') {
        $link = array(
          'title' => l($plugin['title'], 'admin/build/pages/wizard/' . $id),
          'description' => $plugin['description'],
        );
        $vars['blocks']['wizards']['content'] .= theme('panels_dashboard_link', $link);
      }
    }
  }
  uasort($vars['links'], 'ctools_plugin_sort');
  $vars['blocks']['links'] = array(
    'weight' => -100,
    'section' => 'left',
    'title' => t('Create new') . '...',
    'content' => '',
    'class' => 'dashboard-create',
  );

  // Turn the links into a block
  foreach ($vars['links'] as $link) {
    $vars['blocks']['links']['content'] .= theme('panels_dashboard_link', $link);
  }
  uasort($vars['blocks'], 'ctools_plugin_sort');
  $vars['left'] = '';
  $vars['right'] = '';

  // Render all the blocks
  foreach ($vars['blocks'] as $block) {
    $section = !empty($block['section']) ? $block['section'] : 'left';
    $vars[$section] .= theme('panels_dashboard_block', $block);
  }
}