persepolis
persepolis

Reputation: 789

Drupal 7 - why is my action not showing up in the triggers menu?

I've added a second element to the userbeep_action_info() hook which I plan to make into a new action, but when I check it in the Triggers page, it doesn't appear. The first item, userbeep_beep_action shows, but not the second. Why is this? Is it because it's configurable that it needs extra information to appear? My book asks me to check for its presence at this stage but it isn't appearing.

<?php

/**
 * @file
 * Writes to the log every time a user logs in or edits a node.
 */

/**
 * Implementation of hook_action_info().
 */
function userbeep_action_info() {
    return array(
        'userbeep_beep_action' => array(
            'type' => 'system',
            'label' => t('Beep annoyingly'),
            'configurable' => FALSE,
            'triggers' => array('node_view', 'node_insert', 'node_update', 'node_delete')
        ),
        'userbeep_multiple_beep_action' => array(
            'type' => 'system',
            'label' => t('Beep multiple times'),
            'configurable' => TRUE,
            'triggers' => array('node_view', 'node_insert', 'node_update', 'node_delete')
        )
    );
}

/**
 * Simulate a beep. A Drupal action.
 */
function userbeep_beep_action() {
    watchdog('beep', 'Beep! at ' . '');
}

Upvotes: 1

Views: 1181

Answers (2)

SpaceBeers
SpaceBeers

Reputation: 13957

From the Book's error corrections site - http://www.drupalbook.com/errata3

Error: The screenshot in Figure 3.4 is of the wrong overlay. (What is shown in Figure 3.4 is not available until an instance of the advanced action has been created as described on pp. 43-44 and in Figure 3.5.)

Correction: What should be shown in Figure 3.4 is the overlay accessed by clicking the Configuration link in the top menu and then clicking on the Actions link in the Configuration page, and finally scrolling to the bottom of the overlay to the "Create an Advanced Action" drop-down select box.

The figure you're basing your assumption that your code isn't working isn't the right one. Complete the rest of the chapter and you'll get it working. Use the resource above to hunt down more errors in the book.

Hint: There are quite a few...

Upvotes: 3

persepolis
persepolis

Reputation: 789

It is not showing up because advanced (configurable) actions need to be created and configured once defined in code at: /admin/config/system/actions, where as simple actions do not. It may also require the configuration form and actions to be defined first as well.

Upvotes: 0

Related Questions