You are here

function panels_panels_dashboard_blocks in Panels 6.3

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

Implementation of hook_panels_dashboard_blocks().

Adds page information to the Panels dashboard.

File

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

Code

function panels_panels_dashboard_blocks(&$vars) {
  $vars['links']['panels_layout'] = array(
    'title' => l(t('Custom layout'), 'admin/build/panels/layouts/add'),
    'description' => t('Custom layouts can add more, site-specific layouts that you can use in your panels.'),
  );

  // Load all mini panels and their displays.
  ctools_include('export');
  $items = ctools_export_crud_load_all('panels_layout');
  $count = 0;
  $rows = array();
  foreach ($items as $item) {
    $rows[] = array(
      check_plain($item->admin_title),
      array(
        'data' => l(t('Edit'), "admin/build/panels/layouts/list/{$item->name}/edit"),
        'class' => 'links',
      ),
    );

    // Only show 10.
    if (++$count >= 10) {
      break;
    }
  }
  if ($rows) {
    $content = theme('table', array(), $rows, array(
      'class' => 'panels-manage',
    ));
  }
  else {
    $content = '<p>' . t('There are no custom layouts.') . '</p>';
  }
  $vars['blocks']['panels_layout'] = array(
    'title' => t('Manage custom layouts'),
    'link' => l(t('Go to list'), 'admin/build/panels/layouts'),
    'content' => $content,
    'class' => 'dashboard-layouts',
    'section' => 'right',
  );
}