3

I'm trying to figure out how I can alter the theme for read more links. This is what goes on inside the node.module ~ line 1380.

$node->content['links']['node'] = array(
  '#theme' => 'links__node__node',
  '#links' => $links,
  '#attributes' => array('class' => array('links', 'inline')),
);

I know where are several ways to remove the read more links and add your own, but I just want to know where that theme function is stored and how I can override it like it can be done with fields using theme_field().

2 Answers 正确答案

1

The function defined in include/theme.inc is theme_links($variables); in your theme define yourtheme_links($variables).

3

The "links__node__node" theme function is not defined from any Drupal module. If a module defines a theme function matching that name, then Drupal will use it; otherwise, the function that is going to be used is theme_links().

In your theme, you can define both the theme functions. The difference is that theme_links() is generally used, while the other theme function is used just in a specific case.

function themename_links__node__node(&$variables) {
  $links = $variables['links'];
  $attributes = $variables['attributes'];
  // …
}
function themename_links(&$variables) {
  $links = $variables['links'];
  $attributes = $variables['attributes'];
  $heading = $variables['heading'];
  // …
}

Your Answer

来自  https://drupal.stackexchange.com/questions/16508/where-is-links-node-node-defined