You are here

function panels_mini_panels_dashboard_blocks in Panels 7.3

Same name and namespace in other branches
  1. 6.3 panels_mini/panels_mini.module \panels_mini_panels_dashboard_blocks()

Implementation of hook_panels_dashboard_blocks().

Adds mini panels information to the Panels dashboard.

File

panels_mini/panels_mini.module, line 575
panels_mini.module

Code

function panels_mini_panels_dashboard_blocks(&$vars) {
  $vars['links']['panels_mini'] = array(
    'title' => l(t('Mini panel'), 'admin/structure/mini-panels/add'),
    'description' => t('Mini panels are small content areas exposed as blocks, for when you need to have complex block layouts or layouts within layouts.'),
    'weight' => -1,
  );

  // Load all mini panels and their displays.
  $panel_minis = panels_mini_load_all();
  $count = 0;
  $rows = array();
  foreach ($panel_minis as $panel_mini) {
    $rows[] = array(
      check_plain($panel_mini->admin_title),
      array(
        'data' => l(t('Edit'), "admin/structure/mini-panels/list/{$panel_mini->name}/edit"),
        'class' => 'links',
      ),
    );

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