summaryrefslogtreecommitdiff
path: root/modules/trigger
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2009-03-08 04:25:07 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2009-03-08 04:25:07 +0000
commitddc2604d694892f6576a5cfa970a4bcfda6ec270 (patch)
tree19ea28561e1c99c287f4a040adf98740903cb2da /modules/trigger
parentad84a92662cea2c8ad2e1d29ccdc7234627d4a51 (diff)
downloadbrdo-ddc2604d694892f6576a5cfa970a4bcfda6ec270.tar.gz
brdo-ddc2604d694892f6576a5cfa970a4bcfda6ec270.tar.bz2
#383066 by David Strauss: Rename hook_nodeapi_X to hook_node_X.
Diffstat (limited to 'modules/trigger')
-rw-r--r--modules/trigger/trigger.admin.inc11
-rw-r--r--modules/trigger/trigger.api.php12
-rw-r--r--modules/trigger/trigger.install2
-rw-r--r--modules/trigger/trigger.module38
-rw-r--r--modules/trigger/trigger.test2
5 files changed, 31 insertions, 34 deletions
diff --git a/modules/trigger/trigger.admin.inc b/modules/trigger/trigger.admin.inc
index 5a33b6249..7d6c2621e 100644
--- a/modules/trigger/trigger.admin.inc
+++ b/modules/trigger/trigger.admin.inc
@@ -20,9 +20,6 @@ function trigger_assign($type = NULL) {
if (!isset($type)) {
drupal_goto('admin/build/trigger/node');
}
- if ($type == 'node') {
- $type = 'nodeapi';
- }
$output = '';
$hooks = module_invoke_all('hook_info');
@@ -68,7 +65,7 @@ function trigger_unassign($form_state, $hook = NULL, $op = NULL, $aid = NULL) {
$action = actions_function_lookup($aid);
$actions = actions_get_all_actions();
- $destination = 'admin/build/trigger/' . ($hook == 'nodeapi' ? 'node' : $hook);
+ $destination = 'admin/build/trigger/' . ($hook == 'node' ? 'node' : $hook);
return confirm_form($form,
t('Are you sure you want to unassign the action %title?', array('%title' => $actions[$action]['description'])),
@@ -86,7 +83,7 @@ function trigger_unassign_submit($form, &$form_state) {
$actions = actions_get_all_actions();
watchdog('actions', 'Action %action has been unassigned.', array('%action' => check_plain($actions[$aid]['description'])));
drupal_set_message(t('Action %action has been unassigned.', array('%action' => $actions[$aid]['description'])));
- $hook = $form_values['hook'] == 'nodeapi' ? 'node' : $form_values['hook'];
+ $hook = $form_values['hook'] == 'node' ? 'node' : $form_values['hook'];
$form_state['redirect'] = 'admin/build/trigger/' . $hook;
}
else {
@@ -100,7 +97,7 @@ function trigger_unassign_submit($form, &$form_state) {
* @param $form_state
* Information about the current form.
* @param $hook
- * The name of the hook, e.g., 'nodeapi'.
+ * The name of the hook, e.g., 'node'.
* @param $op
* The name of the hook operation, e.g., 'insert'.
* @param $description
@@ -263,7 +260,7 @@ function theme_trigger_display($element) {
* One of 'node', 'user', 'comment'.
* @param $hook
* The name of the hook for which actions have been assigned,
- * e.g. 'nodeapi'.
+ * e.g. 'node'.
* @param $op
* The hook operation for which the actions have been assigned,
* e.g., 'view'.
diff --git a/modules/trigger/trigger.api.php b/modules/trigger/trigger.api.php
index e495513a3..d9c2eca1a 100644
--- a/modules/trigger/trigger.api.php
+++ b/modules/trigger/trigger.api.php
@@ -46,7 +46,7 @@
* assigning actions to events. If you are writing actions in your own
* modules and you simply want to declare support for all possible hooks,
* you can set 'hooks' => array('any' => TRUE). Common hooks are 'user',
- * 'nodeapi', 'comment', or 'taxonomy'. Any hook that has been described
+ * 'node', 'comment', or 'taxonomy'. Any hook that has been described
* to Drupal in hook_hook_info() will work is a possiblity.
* - 'behavior': (optional) Human-readable array of behavior descriptions.
* The only one we have now is 'changes node property'. You will almost
@@ -58,7 +58,7 @@
* hook_action_info array, and a context variable that contains the context
* under which the action is currently running, sent as an array. For example,
* the actions module sets the 'hook' and 'op' keys of the context array (so,
- * 'hook' may be 'nodeapi' and 'op' may be 'insert').
+ * 'hook' may be 'node' and 'op' may be 'insert').
*/
function hook_action_info() {
return array(
@@ -122,15 +122,15 @@ function hook_action_info_alter(&$actions) {
* 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 'nodeapi' as the next key,
- * as hook_nodeapi() is what applies to changes in nodes. Finally the keys
- * after that are the various operations for hook_nodeapi() that the node module
+ * 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.
*/
function hook_hook_info() {
return array(
'node' => array(
- 'nodeapi' => array(
+ 'node' => array(
'presave' => array(
'runs when' => t('When either saving a new post or updating an existing post'),
),
diff --git a/modules/trigger/trigger.install b/modules/trigger/trigger.install
index c6bb061b0..db360507d 100644
--- a/modules/trigger/trigger.install
+++ b/modules/trigger/trigger.install
@@ -32,7 +32,7 @@ function trigger_schema() {
'length' => 32,
'not null' => TRUE,
'default' => '',
- 'description' => 'Primary Key: The name of the internal Drupal hook upon which an action is firing; for example, nodeapi.',
+ 'description' => 'Primary Key: The name of the internal Drupal hook upon which an action is firing; for example, node.',
),
'op' => array(
'type' => 'varchar',
diff --git a/modules/trigger/trigger.module b/modules/trigger/trigger.module
index 872ebf4ea..6df47e686 100644
--- a/modules/trigger/trigger.module
+++ b/modules/trigger/trigger.module
@@ -181,7 +181,7 @@ function trigger_forms() {
* @param $type
* The type of action that is about to be called.
* @param $node
- * The node that was passed via the nodeapi hook.
+ * The node that was passed via the node hook.
* @return
* The object expected by the action that is about to be called.
*/
@@ -204,7 +204,7 @@ function _trigger_normalize_node_context($type, $node) {
*
* @TODO: Take advantage of the new API and reorganise/remove this function.
*/
-function _trigger_nodeapi($node, $op, $a3 = NULL, $a4 = NULL) {
+function _trigger_node($node, $op, $a3 = NULL, $a4 = NULL) {
// Keep objects for reuse so that changes actions make to objects can persist.
static $objects;
// Prevent recursion by tracking which operations have already been called.
@@ -214,12 +214,12 @@ function _trigger_nodeapi($node, $op, $a3 = NULL, $a4 = NULL) {
}
$recursion[$op] = TRUE;
- $aids = _trigger_get_hook_aids('nodeapi', $op);
+ $aids = _trigger_get_hook_aids('node', $op);
if (!$aids) {
return;
}
$context = array(
- 'hook' => 'nodeapi',
+ 'hook' => 'node',
'op' => $op,
);
@@ -242,38 +242,38 @@ function _trigger_nodeapi($node, $op, $a3 = NULL, $a4 = NULL) {
}
/**
- * Implementation of hook_nodeapi_view().
+ * Implementation of hook_node_view().
*/
-function trigger_nodeapi_view($node, $teaser, $page) {
- _trigger_nodeapi($node, 'view', $teaser, $page);
+function trigger_node_view($node, $teaser, $page) {
+ _trigger_node($node, 'view', $teaser, $page);
}
/**
- * Implementation of hook_nodeapi_update().
+ * Implementation of hook_node_update().
*/
-function trigger_nodeapi_update($node) {
- _trigger_nodeapi($node, 'update');
+function trigger_node_update($node) {
+ _trigger_node($node, 'update');
}
/**
- * Implementation of hook_nodeapi_presave().
+ * Implementation of hook_node_presave().
*/
-function trigger_nodeapi_presave($node) {
- _trigger_nodeapi($node, 'presave');
+function trigger_node_presave($node) {
+ _trigger_node($node, 'presave');
}
/**
- * Implementation of hook_nodeapi_insert().
+ * Implementation of hook_node_insert().
*/
-function trigger_nodeapi_insert($node) {
- _trigger_nodeapi($node, 'insert');
+function trigger_node_insert($node) {
+ _trigger_node($node, 'insert');
}
/**
- * Implementation of hook_nodeapi_delete().
+ * Implementation of hook_node_delete().
*/
-function trigger_nodeapi_delete($node) {
- _trigger_nodeapi($node, 'delete');
+function trigger_node_delete($node) {
+ _trigger_node($node, 'delete');
}
/**
diff --git a/modules/trigger/trigger.test b/modules/trigger/trigger.test
index e11429306..6067a9560 100644
--- a/modules/trigger/trigger.test
+++ b/modules/trigger/trigger.test
@@ -58,7 +58,7 @@ class TriggerContentTestCase extends DrupalWebTestCase {
$this->assertRaw(t('The action you chose is already assigned to that trigger.'), t('Check to make sure an error occurs when assigning an action to a trigger twice.'));
// Test 3: The action should be able to be unassigned from a trigger.
- $this->drupalPost('admin/build/trigger/unassign/nodeapi/presave/' . $hash, array(), t('Unassign'));
+ $this->drupalPost('admin/build/trigger/unassign/node/presave/' . $hash, array(), t('Unassign'));
$this->assertRaw(t('Action %action has been unassigned.', array('%action' => ucfirst($info['name']))), t('Check to make sure the @action action can be unassigned from the trigger.', array('@action' => $info['name'])));
$assigned = db_result(db_query("SELECT COUNT(*) FROM {trigger_assignments} WHERE aid IN ('" . implode("','", $content_actions) . "')"));
$this->assertFalse($assigned, t('Check to make sure unassign worked properly at the database level.'));