/**
 * Implements hook_block_view_MODULE_DELTA_alter().
 */
function bootstrap_subtheme_block_view_api_navigation_alter(&$data, $block)
{
    $branch = api_get_active_branch();
    if (user_access('access API reference') && !empty($branch)) {
        // Figure out if this is the default branch for this project, the same
        // way the menu system decides.
        $branches = api_get_branches();
        $projects = _api_make_menu_projects();
        $is_default = $branch->branch_name === $projects[$branch->project]['use branch'];
        $suffix = $is_default ? '' : '/' . $branch->branch_name;
        $types = array('groups' => t('Topics'), 'classes' => t('Classes'), 'functions' => t('Functions'), 'files' => t('Files'), 'namespaces' => t('Namespaces'), 'services' => t('Services'), 'constants' => t('Constants'), 'globals' => t('Globals'), 'deprecated' => t('Deprecated'));
        $links = array('#theme_wrappers' => array('container__api__navigation'), '#attributes' => array('class' => array('list-group')));
        $current_path = current_path();
        $counts = api_listing_counts($branch);
        $item = _db_api_active_item();
        foreach ($types as $type => $title) {
            if ($type === '' || $counts[$type] > 0) {
                $branch_path = 'api/' . $branch->project;
                $path = $branch_path;
                if ($type) {
                    $path .= "/{$type}";
                    $title = '<span class="badge">' . $counts[$type] . '</span>' . $title;
                }
                $path .= $suffix;
                $class = array('list-group-item');
                if ($type || $type === '' && !$counts['groups']) {
                    if ($type === 'groups') {
                        $path = $branch_path . $suffix;
                    }
                    if ($path === $current_path || $item && preg_match('/^' . $item->object_type . '/', $type)) {
                        $class[] = 'active';
                    }
                    $links[] = array('#theme' => 'link__api__navigation_link', '#text' => $title, '#path' => $path, '#options' => array('html' => TRUE, 'attributes' => array('class' => $class)));
                } else {
                    $links[] = array('#theme' => 'html_tag__api__navigation_link', '#tag' => 'div', '#value' => $title, '#attributes' => array('class' => $class));
                }
            }
        }
        $items = array();
        foreach ($branches as $obj) {
            $is_default = $obj->branch_name === $projects[$obj->project]['use branch'];
            $suffix = $is_default ? '' : '/' . $obj->branch_name;
            $items[] = array('#theme' => 'link', '#text' => $obj->title, '#path' => 'api/' . $obj->project . $suffix, '#options' => array('html' => FALSE, 'attributes' => array()), '#active' => $branch->branch_name === $obj->branch_name);
        }
        $data = array('subject' => t('API Navigation'), 'content' => array('links' => $links, 'branches' => array('#theme' => 'bootstrap_dropdown', '#toggle' => array('#theme' => 'button', '#button_type' => 'button', '#value' => t('Projects') . ' <span class="caret"></span>', '#attributes' => array('class' => array('btn-default', 'btn-block'))), '#items' => $items)));
    }
}
 * @file
 * Displays a branch overview page.
 *
 * Available variables:
 * - $branch: Information about the branch to display an overview of.
 *
 * Available variables in the $branch object:
 * - $branch->project: The machine name of the branch.
 * - $branch->title: A proper title for the branch.
 * - $branch->directories: The local included directories.
 * - $branch->excluded_directories: The local excluded directories.
 *
 * @ingroup themeable
 */
if (!empty($branch)) {
    $counts = api_listing_counts($branch);
    if ($counts['groups'] > 0) {
        ?>
  <h3><?php 
        print l(t('Topics'), 'api/' . $branch->project . '/groups/' . $branch->branch_name);
        ?>
</h3>
  <?php 
        $out = api_page_listing($branch, 'group', FALSE);
        print drupal_render($out);
    }
    if ($counts['files'] > 0) {
        ?>
  <h3><?php 
        print l(t('Files'), 'api/' . $branch->project . '/files/' . $branch->branch_name);
        ?>