Introduce a theme function to theme read_more links. read more HTML in Drupal is a mess currently, sometimes you find 20 different formats and combinations of LIs, divs spans [Read More], read more..., Read more » and all sorts of variations on these. Lets centralise this.

This function comes from helpers module. Dunny where it should live in core, though.

/**
 * Function to theme the read more links
 * @ingroup themeable
 * @param $path a drupal path or full url to the full resource. Include http:// if you link to external resource.
 * @param $title an optional title that will provide a tooltip text when hovering over the link.
 */
function theme_read_more($path, $title = NULL) {
  if ($title) {
    $params['title'] = check_plain($title);
  }
  $params['class'] = 'read-more';
  return l(t('read more'), $path, $params);
}

Comments

magico’s picture

Title: introduce theme_read_more. » Introduce theme_read_more()
Version: 4.7.2 » x.y.z
Category: task » feature

+1

nancydru’s picture

Version: x.y.z » 7.x-dev

Is any one considering this?

jody lynn’s picture

Version: 7.x-dev » 8.x-dev
alan d.’s picture

Title: Introduce theme_read_more() » Use theme_more_link() for all view more links.

Core already has this, theme_more_link(). I'm not sure how many are left to alter, in Drupal 7.x, the node read more link is hard coded in a t().

Related: #1136680: #type 'more_link' - previously theme_more_link() - should have more context

mgifford’s picture

Status: Active » Closed (won't fix)

Just wanting to close this issue.

There's already a generalized link:
http://api.drupal.org/api/drupal/core!includes!theme.inc/function/theme_...

The example in the node I think is going to be an exception to the rule:

        $links['node-readmore'] = array(
          'title' => t('Read more<span class="element-invisible"> about @title</span>', array(
            '@title' => $node_title_stripped,
          )),
          'href' => 'node/' . $entity->nid,
          'html' => TRUE,
          'attributes' => array(
            'rel' => 'tag',
            'title' => $node_title_stripped,
          ),
        );
      }

Feel free to re-open.