You are here

function advanced_forum_forum_list_content_type_render in Advanced Forum 6.2

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

Render the content.

File

plugins/content_types/forum_list.inc, line 21

Code

function advanced_forum_forum_list_content_type_render($subtype, $conf, $panel_args, $context) {
  if (!empty($context) && empty($context->data)) {
    return;
  }
  if (empty($context)) {
    $tid = 0;
  }
  else {
    $tid = $context->data->tid;
  }
  $block = new stdClass();
  $block->module = 'forum-list';
  $block->delta = $tid;
  _advanced_forum_add_files();
  $forums = advanced_forum_get_forums($tid);
  if ($forums) {

    // No parents on the main forum page.
    $parents = isset($context->parents) ? $context->parents : array();
    $block->content = theme('forum_list', $forums, $parents, $tid);
    if (user_access('administer forums')) {
      $block->admin_links['administer_forums'] = array(
        'title' => t('Administer forums'),
        'alt' => t("Add, delete or modify forums"),
        'href' => "admin/content/forum",
      );
      if ($tid) {
        $block->admin_links['edit_forum'] = array(
          'title' => t('Edit forum'),
          'alt' => t("Modify this forum"),
          'href' => "admin/content/forum/edit/" . ($context->data->container ? 'container/' : 'forum/') . $tid,
          'query' => drupal_get_destination(),
        );
      }
    }
  }
  return $block;
}