You are here

function commons_utility_links_block_view in Drupal Commons 7.3

Implements hook_block_view().

File

modules/commons/commons_utility_links/commons_utility_links.module, line 34

Code

function commons_utility_links_block_view($delta = '') {
  $block = array();
  switch ($delta) {
    case 'commons_utility_links':

      // Gather all of the available utility links.
      $links = module_invoke_all('commons_utility_links');
      drupal_alter('commons_utility_links', $links);
      if (!empty($links)) {

        // Sort the links by weight before rendering them.
        uasort($links, 'drupal_sort_weight');
        $block['subject'] = NULL;
        $block['content'] = array(
          '#theme' => 'links__commons_utility_links',
          '#links' => $links,
          '#attributes' => array(
            'class' => array(
              'commons-utility-links',
            ),
          ),
        );
      }
      break;
  }
  return $block;
}