You are here

function commons_origins_commons_utility_links_alter in Drupal Commons 7.3

Implements hook_commons_utility_links_alter().

File

themes/commons/commons_origins/template.php, line 28
Process theme data.

Code

function commons_origins_commons_utility_links_alter(&$element) {

  // Add wrappers to title elements in notification links so that they can be
  // replaced with an icon.
  $iconify = array(
    'unread-invitations',
    'unread-messages',
  );
  foreach ($iconify as $name) {
    if (isset($element[$name])) {
      $words = explode(' ', $element[$name]['title']);
      foreach ($words as &$word) {
        if (is_numeric($word)) {
          $word = '<span class="notification-count">' . $word . '</span>';
        }
        else {
          $word = '<span class="notification-label element-invisible">' . $word . '</span>';
        }
      }
      $element[$name]['title'] = implode(' ', $words);
      $element[$name]['html'] = TRUE;
    }
  }
}