You are here

function total_control_menus_content_type_render in Total Control Admin Dashboard 6.2

Same name and namespace in other branches
  1. 7.2 plugins/content_types/menus.inc \total_control_menus_content_type_render()

Run-time rendering of the body of the block.

Parameters

$subtype:

$conf: Configuration as done at admin time.

$args:

$context: Context - in this case we don't have any.

Return value

An object with at least title and content members.

1 string reference to 'total_control_menus_content_type_render'
menus.inc in plugins/content_types/menus.inc
panel_pages.inc

File

plugins/content_types/menus.inc, line 64
panel_pages.inc

Code

function total_control_menus_content_type_render($subtype, $conf, $args, $context) {
  $header = array(
    t('Page'),
    t('Operations'),
  );
  $rows = array();
  $menus = menu_get_menus();
  $options = array(
    'query' => array(
      'destination' => 'admin/dashboard',
    ),
  );
  $header = array(
    'page' => t('Menu'),
    'options' => array(
      'data' => t('Operations'),
      'colspan' => 2,
    ),
  );
  $rows = array();
  foreach ($menus as $menu_name => $menu) {
    if (!isset($conf['menus'][$menu_name]) || $conf['menus'][$menu_name] === $menu_name) {
      $rows[] = array(
        'data' => array(
          t($menu),
          l(t('Edit menu'), 'admin/build/menu-customize/' . $menu_name, $options),
          l(t('Add new link'), 'admin/build/menu-customize/' . $menu_name . '/add', $options),
        ),
      );
    }
  }
  if (empty($rows)) {
    $rows[] = array(
      array(
        'data' => t('There are no menus to display.'),
        'colspan' => 3,
      ),
    );
  }

  // Build a link to the menu UI.
  if (user_access('administer menus')) {
    $link = l(t('Menu administration'), 'admin/build/menu');
  }
  $block = new stdClass();
  $block->module = t('total_control');
  $block->title = t('Administer Menus');
  $block->content = theme('total_control_admin_table', $header, $rows, $link);
  return $block;
}