You are here

function total_control_create_content_type_render in Total Control Admin Dashboard 6

Same name and namespace in other branches
  1. 6.2 plugins/content_types/create.inc \total_control_create_content_type_render()
  2. 7.2 plugins/content_types/create.inc \total_control_create_content_type_render()

File

plugins/content_types/create.inc, line 29

Code

function total_control_create_content_type_render($subtype, $conf, $panel_args, &$context) {
  $block = new stdClass();
  $block->module = t('total_control');
  $types = node_get_types('types');
  $create = array();
  foreach ($types as $type => $object) {
    $row = '';

    // compare against type option on pane config
    if (isset($conf['types']) && $conf['types'][$type] || $conf == array()) {
      $type_link = str_replace('_', '-', $object->type);

      // check access to create nodes of this type
      if (user_access('create ' . $type . ' content')) {
        $row = l(t('Add New ' . $object->name), 'node/add/' . $type_link);
      }

      // check access to administer content types
      if (variable_get('total_control_configure_links', 1) == 1 && user_access('administer content types')) {
        $row .= ' | ' . l(t('Configure'), 'admin/content/node-type/' . $type_link);
      }
      $create[] = $row;
    }

    // end if type
  }

  // assemble content
  $content = '<div class="total-control-content-overview">';
  $content .= '  <h2 class="title">' . t('Content Control') . '</h2>';
  $content .= '  <div class="content">';
  $content .= theme('item_list', $create);
  $content .= '  </div>';
  $content .= '</div>';
  $block->content = $content;
  return $block;
}