You are here

function stylizer_panels_dashboard_blocks in Chaos Tool Suite (ctools) 7

Same name and namespace in other branches
  1. 6 stylizer/stylizer.module \stylizer_panels_dashboard_blocks()

Implementation of hook_panels_dashboard_blocks().

Adds page information to the Panels dashboard.

File

stylizer/stylizer.module, line 56
Stylizer module.

Code

function stylizer_panels_dashboard_blocks(&$vars) {
  $vars['links']['stylizer'] = array(
    'title' => l(t('Custom style'), 'admin/structure/stylizer/add'),
    'description' => t('Custom styles can be applied to Panel regions and Panel panes.'),
  );

  // Load all mini panels and their displays.
  ctools_include('export');
  ctools_include('stylizer');
  $items = ctools_export_crud_load_all('stylizer');
  $count = 0;
  $rows = array();
  $base_types = ctools_get_style_base_types();
  foreach ($items as $item) {
    $style = ctools_get_style_base($item->settings['style_base']);
    if ($style && $style['module'] == 'panels') {
      $type = $base_types[$style['module']][$style['type']]['title'];
      $rows[] = array(
        check_plain($item->admin_title),
        $type,
        array(
          'data' => l(t('Edit'), "admin/structure/stylizer/list/{$item->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 custom styles.') . '</p>';
  }
  $vars['blocks']['stylizer'] = array(
    'title' => t('Manage styles'),
    'link' => l(t('Go to list'), 'admin/structure/stylizer'),
    'content' => $content,
    'class' => 'dashboard-styles',
    'section' => 'left',
  );
}