You are here

function total_control_panel_pages_content_type_render in Total Control Admin Dashboard 7.2

Same name and namespace in other branches
  1. 6.2 plugins/content_types/panel_pages.inc \total_control_panel_pages_content_type_render()

Run-time rendering of the body of the block.

File

plugins/content_types/panel_pages.inc, line 41

Code

function total_control_panel_pages_content_type_render($subtype, $conf, $args, &$context) {
  $items = array();

  // Get panels pages.
  module_load_include('inc', 'page_manager', 'page_manager.admin');
  $tasks = page_manager_get_tasks_by_type('page');
  $pages = array(
    'operations' => array(),
  );
  page_manager_get_pages($tasks, $pages);
  $count = 0;

  // TODO setting.
  $header = array(
    'page' => t('Page'),
    'options' => t('Operations'),
  );
  $rows = array();
  foreach ($pages['rows'] as $id => $info) {

    // Only show enabled panels on the pane. // TODO: config setting?
    if (array_key_exists('data', $info['data']['operations']) && stristr((string) $info['data']['operations']['data'], 'Enable') == FALSE) {
      $rows[] = array(
        'data' => array(
          $info['data']['title'],
          $info['data']['operations'],
        ),
        'class' => $info['class'],
      );

      // Only show a certain number.
      if (++$count >= 10) {
        break;
      }
    }
  }

  // Build a link to the page manager UI.
  $link = '';
  if (user_access('use page manager')) {
    $link = l(t('Page manager administration'), 'admin/structure/pages');
  }
  $block = new stdClass();
  $block->title = t('Manage Panel pages');
  $block->module = t('total_control');
  $block->content = theme('total_control_admin_table', array(
    'header' => $header,
    'rows' => $rows,
    'link' => $link,
  ));
  return $block;
}