hook_hook_info

  1. drupal
    1. drupal6 core.php
    2. drupal7
Versionen
drupal6 – drupal7 hook_hook_info()

Expose a list of triggers (events) that your module is allowing users to assign actions to.

This hook is used by the Triggers API to present information about triggers (or events) that your module allows users to assign actions to.

See also hook_action_info().

Rückgabewert

  • A nested array. The outermost key defines the module that the triggers are from. The menu system will use the key to look at the .info file of the module and make a local task (a tab) in the trigger UI.

    • The next key defines the hook being described.

      • Inside of that array are a list of arrays keyed by hook operation.

        • Each of those arrays have a key of 'runs when' and a value which is an English description of the hook.

For example, the node_hook_info implementation has 'node' as the outermost key, as that's the module it's in. Next it has 'node' as the next key, as hook_node() is what applies to changes in nodes. Finally the keys after that are the various operations for hook_node() that the node module is exposing as triggers.

Verwandte Themen

Code

modules/trigger/trigger.api.php, line 130

<?php
function hook_hook_info() {
  return array(
    'node' => array(
      'node' => array(
        'presave' => array(
          'runs when' => t('When either saving a new post or updating an existing post'),
        ),
        'insert' => array(
          'runs when' => t('After saving a new post'),
        ),
        'update' => array(
          'runs when' => t('After saving an updated post'),
        ),
        'delete' => array(
          'runs when' => t('After deleting a post')
        ),
        'view' => array(
          'runs when' => t('When content is viewed by an authenticated user')
        ),
      ),
    ),
  );
}
?>

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