You are here

function total_control_node_types_content_type_render in Total Control Admin Dashboard 6.2

Same name and namespace in other branches
  1. 7.2 plugins/content_types/node_types.inc \total_control_node_types_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_node_types_content_type_render'
node_types.inc in plugins/content_types/node_types.inc
panel_pages.inc

File

plugins/content_types/node_types.inc, line 68
panel_pages.inc

Code

function total_control_node_types_content_type_render($subtype, $conf, $args, $context) {
  $header = array(
    t('Page'),
    t('Operations'),
  );
  $rows = array();
  $types = node_get_types('types');
  $access = user_access('administer content types');
  $options = array(
    'query' => array(
      'destination' => 'admin/dashboard',
    ),
  );
  $header = array(
    array(
      'data' => t('Content type'),
    ),
    array(
      'data' => t('Operations'),
      'colspan' => 3,
    ),
  );
  $rows = array();
  foreach ($types as $type => $object) {

    // Config data says to include the type.
    if (!array_key_exists($type, $conf['types']) || isset($conf['types']) && $conf['types'][$type] == $type) {

      // Check access, then add a link to create content.
      if ($access) {
        $type_url_str = str_replace('_', '-', $object->type);
        $rows[$type] = array(
          'data' => array(
            t($object->name),
            l(t('Configure'), 'admin/content/node-type/' . $type_url_str, $options),
          ),
        );
        if (module_exists('content')) {
          $rows[$type]['data'][] = l(t('Manage fields'), 'admin/content/node-type/' . $type_url_str . '/fields', $options);
          $rows[$type]['data'][] = l(t('Manage display'), 'admin/content/node-type/' . $type_url_str . '/display', $options);
        }
      }
    }
  }
  if (empty($rows)) {
    $rows[] = array(
      array(
        'data' => t('There are no content types to display.'),
        'colspan' => 4,
      ),
    );
  }

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