hook_link

  1. drupal
    1. drupal6 core.php
    2. drupal7
Versionen
drupal6 – drupal7 hook_link($type, $object, $teaser = FALSE)

Define internal Drupal links.

This hook enables modules to add links to many parts of Drupal. Links may be added in the navigation block, for example.

The returned array should be a keyed array of link entries. Each link can be in one of two formats.

The first format will use the l() function to render the link:

  • attributes: Optional. See l() for usage.
  • fragment: Optional. See l() for usage.
  • href: Required. The URL of the link.
  • html: Optional. See l() for usage.
  • query: Optional. See l() for usage.
  • title: Required. The name of the link.

The second format can be used for non-links. Leaving out the href index will select this format:

  • title: Required. The text or HTML code to display.
  • attributes: Optional. An associative array of HTML attributes to apply to the span tag.
  • html: Optional. If not set to true, check_plain() will be run on the title before it is displayed.

Übergabeparameter

$type An identifier declaring what kind of link is being requested. Possible values:

  • comment: Links to be placed below a comment being viewed.

$object A comment object.

$teaser A 0/1 flag depending on whether the node is displayed with its teaser or its full form.

Rückgabewert

An array of the requested links.

Verwandte Themen

Code

modules/system/system.api.php, line 447

<?php
function hook_link($type, $object, $teaser = FALSE) {
  $links = array();

  if ($type == 'comment') {
    $links = comment_links($object, FALSE);
    return $links;
  }

  return $links;
}
?>

Kommentare

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen