function theme_links


Error message

User warning: The following module is missing from the file system: theme/theme. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1156 of /var/www/html/elmsln_community/
cis7 theme_links($variables)
cle7 theme_links($variables)
elmsmedia7 theme_links($variables)
icor7 theme_links($variables)
meedjum_blog7 theme_links($variables)
mooc7 theme_links($variables)

Returns HTML for a set of links.


$variables: An associative array containing:

  • links: An associative array of links to be themed. The key for each link is used as its CSS class. Each link should be itself an array, with the following elements:

    • title: The link text.
    • href: The link URL. If omitted, the 'title' is shown as a plain text item in the links list.
    • html: (optional) Whether or not 'title' is HTML. If set, the title will not be passed through check_plain().
    • attributes: (optional) Attributes for the anchor, or for the <span> tag used in its place if no 'href' is supplied. If element 'class' is included, it must be an array of one or more class names.

    If the 'href' element is supplied, the entire link array is passed to l() as its $options parameter.

  • attributes: A keyed array of attributes for the UL containing the list of links.
  • heading: (optional) A heading to precede the links. May be an associative array or a string. If it's an array, it can have the following elements:

    • text: The heading text.
    • level: The heading level (e.g. 'h2', 'h3').
    • class: (optional) An array of the CSS classes for the heading.

    When using a string it will be used as the text of the heading and the level will default to 'h2'. Headings should be used on navigation menus and any list of links that consistently appears on multiple pages. To make the heading invisible use the 'element-invisible' CSS class. Do not use 'display:none', which removes it from screen-readers and assistive technology. Headings allow screen-reader and keyboard only users to navigate to or skip the links. See and for more information.

Related topics

3 calls to theme_links()
ember_links__ctools_dropbutton in sites/all/themes/ulmus/ember/template.php
Overrides theme_links__ctools_dropbutton().
theme_ctools_dropdown in sites/all/modules/ulmus/ctools/includes/
Create a dropdown menu.
theme_links__ctools_dropbutton in sites/all/modules/ulmus/ctools/includes/
Create a dropbutton menu.
63 theme calls to theme_links()
adaptivetheme_preprocess_page in sites/all/themes/ulmus/adaptivetheme/at_core/inc/
Preprocess variables for page.tpl.php
boxes_block_view in sites/all/modules/ulmus/boxes/boxes.module
Implements hook_block_view().
context-ui-plugins.tpl.php in sites/all/modules/ulmus/context/context_ui/theme/context-ui-plugins.tpl.php
context_export_ui::list_build_row in sites/all/modules/ulmus/context/context_ui/export_ui/context_export_ui.class.php
Build a row based on the item.
ctools_ajax_sample_page in sites/all/modules/ulmus/ctools/ctools_ajax_sample/ctools_ajax_sample.module
Page callback to display links and render a container for AJAX stuff.

... See full list

215 string references to the theme hook from theme_links()

Note: this list is generated by looking for the string for this theme hook, so it may include some references that are not actually using this theme hook.

adaptivetheme_form_user_login_block_alter in sites/all/themes/ulmus/adaptivetheme/at_core/inc/
hook_form_FORM_ID_alter() Modify the User Login Block Form
adaptivetheme_links in sites/all/themes/ulmus/adaptivetheme/at_core/inc/
Returns HTML for a set of links.
adaptivetheme_preprocess_node in sites/all/themes/ulmus/adaptivetheme/at_core/inc/
Preprocess variables for node.tpl.php
adaptivetheme_preprocess_page in sites/all/themes/ulmus/adaptivetheme/at_core/inc/
Preprocess variables for page.tpl.php
advanced_help_form_system_modules_alter in sites/all/modules/ulmus/advanced_help/advanced_help.module
Implements hook_form_system_modules_alter().

... See full list


includes/, line 1685
The theme system, which controls the output of Drupal.


function theme_links($variables) {
  $links = $variables['links'];
  $attributes = $variables['attributes'];
  $heading = $variables['heading'];
  global $language_url;
  $output = '';

  if (count($links) > 0) {
    $output = '';

    // Treat the heading first if it is present to prepend it to the
    // list of links.
    if (!empty($heading)) {
      if (is_string($heading)) {
        // Prepare the array that will be used when the passed heading
        // is a string.
        $heading = array(
          'text' => $heading,
          // Set the default level of the heading.
          'level' => 'h2',
      $output .= '<' . $heading['level'];
      if (!empty($heading['class'])) {
        $output .= drupal_attributes(array('class' => $heading['class']));
      $output .= '>' . check_plain($heading['text']) . '</' . $heading['level'] . '>';

    $output .= '<ul' . drupal_attributes($attributes) . '>';

    $num_links = count($links);
    $i = 1;

    foreach ($links as $key => $link) {
      $class = array($key);

      // Add first, last and active classes to the list of links to help out themers.
      if ($i == 1) {
        $class[] = 'first';
      if ($i == $num_links) {
        $class[] = 'last';
      if (isset($link['href']) && ($link['href'] == $_GET['q'] || ($link['href'] == '<front>' && drupal_is_front_page())) && (empty($link['language']) || $link['language']->language == $language_url->language)) {
        $class[] = 'active';
      $output .= '<li' . drupal_attributes(array('class' => $class)) . '>';

      if (isset($link['href'])) {
        // Pass in $link as $options, they share the same keys.
        $output .= l($link['title'], $link['href'], $link);
      elseif (!empty($link['title'])) {
        // Some links are actually not links, but we wrap these in <span> for adding title and class attributes.
        if (empty($link['html'])) {
          $link['title'] = check_plain($link['title']);
        $span_attributes = '';
        if (isset($link['attributes'])) {
          $span_attributes = drupal_attributes($link['attributes']);
        $output .= '<span' . $span_attributes . '>' . $link['title'] . '</span>';

      $output .= "</li>\n";

    $output .= '</ul>';

  return $output;