#383066 by David Strauss: Rename hook_nodeapi_X to hook_node_X.
parent
ad84a92662
commit
ddc2604d69
includes
modules
blog
blogapi
book
comment
forum
menu
path
statistics
system
taxonomy
translation
upload
|
@ -119,7 +119,7 @@ function actions_do($action_ids, $object = NULL, $context = NULL, $a1 = NULL, $a
|
|||
* 'description' => t('Save node'),
|
||||
* 'configurable' => FALSE,
|
||||
* 'hooks' => array(
|
||||
* 'nodeapi' => array('delete', 'insert', 'update', 'view'),
|
||||
* 'node' => array('delete', 'insert', 'update', 'view'),
|
||||
* 'comment' => array('delete', 'insert', 'update', 'view'),
|
||||
* )
|
||||
* )
|
||||
|
@ -147,7 +147,7 @@ function actions_do($action_ids, $object = NULL, $context = NULL, $a1 = NULL, $a
|
|||
* 'description' => t('Publish post'),
|
||||
* 'configurable' => FALSE,
|
||||
* 'hooks' => array(
|
||||
* 'nodeapi' => array('presave', 'insert', 'update', 'view'),
|
||||
* 'node' => array('presave', 'insert', 'update', 'view'),
|
||||
* 'comment' => array('delete', 'insert', 'update', 'view'),
|
||||
* ),
|
||||
* );
|
||||
|
|
|
@ -94,9 +94,9 @@ function blog_view($node, $teaser) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_view.
|
||||
* Implementation of hook_node_view.
|
||||
*/
|
||||
function blog_nodeapi_view($node, $teaser = FALSE) {
|
||||
function blog_node_view($node, $teaser = FALSE) {
|
||||
if ($node->type == 'blog') {
|
||||
if (arg(0) != 'blog' || arg(1) != $node->uid) {
|
||||
$links['blog_usernames_blog'] = array(
|
||||
|
|
|
@ -224,7 +224,7 @@ function blogapi_blogger_new_post($appkey, $blogid, $username, $password, $conte
|
|||
$edit['date'] = format_date(REQUEST_TIME, 'custom', 'Y-m-d H:i:s O');
|
||||
}
|
||||
|
||||
node_invoke_nodeapi($edit, 'blogapi_new');
|
||||
node_invoke_node($edit, 'blogapi_new');
|
||||
|
||||
$valid = blogapi_status_error_check($edit, $publish);
|
||||
if ($valid !== TRUE) {
|
||||
|
@ -282,7 +282,7 @@ function blogapi_blogger_edit_post($appkey, $postid, $username, $password, $cont
|
|||
$node->body = $content;
|
||||
}
|
||||
|
||||
node_invoke_nodeapi($node, 'blogapi_edit');
|
||||
node_invoke_node($node, 'blogapi_edit');
|
||||
|
||||
$valid = blogapi_status_error_check($node, $original_status);
|
||||
if ($valid !== TRUE) {
|
||||
|
|
|
@ -63,7 +63,7 @@ function book_perm() {
|
|||
/**
|
||||
* Inject links into $node as needed.
|
||||
*/
|
||||
function book_nodeapi_view_link($node, $teaser, $page) {
|
||||
function book_node_view_link($node, $teaser, $page) {
|
||||
$links = array();
|
||||
|
||||
if (isset($node->book['depth'])) {
|
||||
|
@ -720,9 +720,9 @@ function book_build_active_trail($book_link) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_load().
|
||||
* Implementation of hook_node_load().
|
||||
*/
|
||||
function book_nodeapi_load($nodes, $types) {
|
||||
function book_node_load($nodes, $types) {
|
||||
$result = db_query("SELECT * FROM {book} b INNER JOIN {menu_links} ml ON b.mlid = ml.mlid WHERE b.nid IN (:nids)", array(':nids' => array_keys($nodes)), array('fetch' => PDO::FETCH_ASSOC));
|
||||
foreach ($result as $record) {
|
||||
$nodes[$record['nid']]->book = $record;
|
||||
|
@ -733,9 +733,9 @@ function book_nodeapi_load($nodes, $types) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_view().
|
||||
* Implementation of hook_node_view().
|
||||
*/
|
||||
function book_nodeapi_view($node, $teaser, $page) {
|
||||
function book_node_view($node, $teaser, $page) {
|
||||
if (!$teaser) {
|
||||
if (!empty($node->book['bid']) && $node->build_mode == NODE_BUILD_NORMAL) {
|
||||
$node->content['book_navigation'] = array(
|
||||
|
@ -750,13 +750,13 @@ function book_nodeapi_view($node, $teaser, $page) {
|
|||
}
|
||||
}
|
||||
|
||||
book_nodeapi_view_link($node, $teaser, $page);
|
||||
book_node_view_link($node, $teaser, $page);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_presave().
|
||||
* Implementation of hook_node_presave().
|
||||
*/
|
||||
function book_nodeapi_presave($node) {
|
||||
function book_node_presave($node) {
|
||||
// Always save a revision for non-administrators.
|
||||
if (!empty($node->book['bid']) && !user_access('administer nodes')) {
|
||||
$node->revision = 1;
|
||||
|
@ -772,9 +772,9 @@ function book_nodeapi_presave($node) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_insert().
|
||||
* Implementation of hook_node_insert().
|
||||
*/
|
||||
function book_nodeapi_insert($node) {
|
||||
function book_node_insert($node) {
|
||||
if (!empty($node->book['bid'])) {
|
||||
if ($node->book['bid'] == 'new') {
|
||||
// New nodes that are their own book.
|
||||
|
@ -787,9 +787,9 @@ function book_nodeapi_insert($node) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_update().
|
||||
* Implementation of hook_node_update().
|
||||
*/
|
||||
function book_nodeapi_update($node) {
|
||||
function book_node_update($node) {
|
||||
if (!empty($node->book['bid'])) {
|
||||
if ($node->book['bid'] == 'new') {
|
||||
// New nodes that are their own book.
|
||||
|
@ -802,9 +802,9 @@ function book_nodeapi_update($node) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_delete().
|
||||
* Implementation of hook_node_delete().
|
||||
*/
|
||||
function book_nodeapi_delete($node) {
|
||||
function book_node_delete($node) {
|
||||
if (!empty($node->book['bid'])) {
|
||||
if ($node->nid == $node->book['bid']) {
|
||||
// Handle deletion of a top-level post.
|
||||
|
@ -825,9 +825,9 @@ function book_nodeapi_delete($node) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_prepare().
|
||||
* Implementation of hook_node_prepare().
|
||||
*/
|
||||
function book_nodeapi_prepare($node) {
|
||||
function book_node_prepare($node) {
|
||||
// Prepare defaults for the add/edit form.
|
||||
if (empty($node->book) && (user_access('add content to books') || user_access('administer book outlines'))) {
|
||||
$node->book = array();
|
||||
|
|
|
@ -414,9 +414,9 @@ function theme_comment_block() {
|
|||
}
|
||||
|
||||
/**
|
||||
* An implementation of hook_nodeapi_view().
|
||||
* An implementation of hook_node_view().
|
||||
*/
|
||||
function comment_nodeapi_view($node, $teaser) {
|
||||
function comment_node_view($node, $teaser) {
|
||||
$links = array();
|
||||
|
||||
if ($node->comment) {
|
||||
|
@ -592,9 +592,9 @@ function comment_form_alter(&$form, $form_state, $form_id) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_load().
|
||||
* Implementation of hook_node_load().
|
||||
*/
|
||||
function comment_nodeapi_load($nodes, $types) {
|
||||
function comment_node_load($nodes, $types) {
|
||||
$comments_enabled = array();
|
||||
|
||||
// Check if comments are enabled for each node. If comments are disabled,
|
||||
|
@ -623,18 +623,18 @@ function comment_nodeapi_load($nodes, $types) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_prepare().
|
||||
* Implementation of hook_node_prepare().
|
||||
*/
|
||||
function comment_nodeapi_prepare($node) {
|
||||
function comment_node_prepare($node) {
|
||||
if (!isset($node->comment)) {
|
||||
$node->comment = variable_get("comment_$node->type", COMMENT_NODE_READ_WRITE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_insert().
|
||||
* Implementation of hook_node_insert().
|
||||
*/
|
||||
function comment_nodeapi_insert($node) {
|
||||
function comment_node_insert($node) {
|
||||
db_insert('node_comment_statistics')
|
||||
->fields(array(
|
||||
'nid' => $node->nid,
|
||||
|
@ -646,9 +646,9 @@ function comment_nodeapi_insert($node) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_delete().
|
||||
* Implementation of hook_node_delete().
|
||||
*/
|
||||
function comment_nodeapi_delete($node) {
|
||||
function comment_node_delete($node) {
|
||||
db_delete('comment')
|
||||
->condition('nid', $node->nid)
|
||||
->execute();
|
||||
|
@ -658,9 +658,9 @@ function comment_nodeapi_delete($node) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_update_index().
|
||||
* Implementation of hook_node_update_index().
|
||||
*/
|
||||
function comment_nodeapi_update_index($node) {
|
||||
function comment_node_update_index($node) {
|
||||
$text = '';
|
||||
$comments = db_query('SELECT subject, comment, format FROM {comment} WHERE nid = :nid AND status = :status', array(':nid' => $node->nid, ':status' => COMMENT_PUBLISHED));
|
||||
foreach ($comments as $comment) {
|
||||
|
@ -678,17 +678,17 @@ function comment_update_index() {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_search_result().
|
||||
* Implementation of hook_node_search_result().
|
||||
*/
|
||||
function comment_nodeapi_search_result($node) {
|
||||
function comment_node_search_result($node) {
|
||||
$comments = db_query('SELECT comment_count FROM {node_comment_statistics} WHERE nid = :nid', array('nid' => $node->nid))->fetchField();
|
||||
return format_plural($comments, '1 comment', '@count comments');
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_rss_item().
|
||||
* Implementation of hook_node_rss_item().
|
||||
*/
|
||||
function comment_nodeapi_rss_item($node) {
|
||||
function comment_node_rss_item($node) {
|
||||
if ($node->comment != COMMENT_NODE_DISABLED) {
|
||||
return array(array('key' => 'comments', 'value' => url('node/' . $node->nid, array('fragment' => 'comments', 'absolute' => TRUE))));
|
||||
}
|
||||
|
|
|
@ -512,7 +512,7 @@ function _field_attach_preprocess($obj_type, &$object) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_prepare_translation.
|
||||
* Implementation of hook_node_prepare_translation.
|
||||
*
|
||||
* TODO D7: We do not yet know if this really belongs in Field API.
|
||||
*/
|
||||
|
|
|
@ -251,7 +251,7 @@ function field_attach_preprocess($obj_type, &$object) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_prepare_translation.
|
||||
* Implementation of hook_node_prepare_translation.
|
||||
*
|
||||
* TODO D7: We do not yet know if this really belongs in Field API.
|
||||
*
|
||||
|
|
|
@ -69,7 +69,7 @@ function field_default_submit($obj_type, &$object, $field, $instance, &$items, $
|
|||
* '#field_name' => 'field_name',
|
||||
* '#object' => $object,
|
||||
* '#object_type' => $obj_type,
|
||||
* // Value of the $teaser param of hook_nodeapi('view').
|
||||
* // Value of the $teaser param of hook_node('view').
|
||||
* '#teaser' => $teaser,
|
||||
* 'items' =>
|
||||
* 0 => array(
|
||||
|
|
|
@ -461,7 +461,7 @@ function field_format($obj_type, $object, $field, $item, $formatter_name = NULL,
|
|||
* The object containing the field to display. Must at least contain the id key,
|
||||
* revision key (if applicable), bundle key, and the field data.
|
||||
* @param $teaser
|
||||
* Similar to hook_nodeapi('view')
|
||||
* Similar to hook_node('view')
|
||||
* @return
|
||||
* The themed output for the field.
|
||||
*/
|
||||
|
|
|
@ -156,14 +156,14 @@ function forum_init() {
|
|||
}
|
||||
|
||||
/**
|
||||
* _forum_nodeapi_check_node_type
|
||||
* _forum_node_check_node_type
|
||||
*
|
||||
* @param mixed $node
|
||||
* @param mixed $vocabulary
|
||||
* @access protected
|
||||
* @return bool
|
||||
*/
|
||||
function _forum_nodeapi_check_node_type($node, $vocabulary) {
|
||||
function _forum_node_check_node_type($node, $vocabulary) {
|
||||
// We are going to return if $node->type is not one of the node
|
||||
// types assigned to the forum vocabulary. If forum_nav_vocabulary
|
||||
// is undefined or the vocabulary does not exist, it clearly cannot
|
||||
|
@ -181,12 +181,12 @@ function _forum_nodeapi_check_node_type($node, $vocabulary) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_view().
|
||||
* Implementation of hook_node_view().
|
||||
*/
|
||||
function forum_nodeapi_view($node, $teaser) {
|
||||
function forum_node_view($node, $teaser) {
|
||||
$vid = variable_get('forum_nav_vocabulary', '');
|
||||
$vocabulary = taxonomy_vocabulary_load($vid);
|
||||
if (_forum_nodeapi_check_node_type($node, $vocabulary)) {
|
||||
if (_forum_node_check_node_type($node, $vocabulary)) {
|
||||
if ((bool)menu_get_object() && taxonomy_node_get_terms_by_vocabulary($node, $vid) && $tree = taxonomy_get_tree($vid)) {
|
||||
// Get the forum terms from the (cached) tree
|
||||
foreach ($tree as $term) {
|
||||
|
@ -219,12 +219,12 @@ function forum_nodeapi_view($node, $teaser) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_prepare().
|
||||
* Implementation of hook_node_prepare().
|
||||
*/
|
||||
function forum_nodeapi_prepare($node) {
|
||||
function forum_node_prepare($node) {
|
||||
$vid = variable_get('forum_nav_vocabulary', '');
|
||||
$vocabulary = taxonomy_vocabulary_load($vid);
|
||||
if (_forum_nodeapi_check_node_type($node, $vocabulary)) {
|
||||
if (_forum_node_check_node_type($node, $vocabulary)) {
|
||||
if (empty($node->nid)) {
|
||||
// New topic
|
||||
$node->taxonomy[arg(3)] = (object) array(
|
||||
|
@ -236,14 +236,14 @@ function forum_nodeapi_prepare($node) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_validate().
|
||||
* Implementation of hook_node_validate().
|
||||
*
|
||||
* Check in particular that only a "leaf" term in the associated taxonomy.
|
||||
*/
|
||||
function forum_nodeapi_validate($node, $form) {
|
||||
function forum_node_validate($node, $form) {
|
||||
$vid = variable_get('forum_nav_vocabulary', '');
|
||||
$vocabulary = taxonomy_vocabulary_load($vid);
|
||||
if (_forum_nodeapi_check_node_type($node, $vocabulary)) {
|
||||
if (_forum_node_check_node_type($node, $vocabulary)) {
|
||||
// vocabulary is selected, not a "container" term.
|
||||
if ($node->taxonomy) {
|
||||
// Extract the node's proper topic ID.
|
||||
|
@ -262,14 +262,14 @@ function forum_nodeapi_validate($node, $form) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_presave().
|
||||
* Implementation of hook_node_presave().
|
||||
*
|
||||
* Assign forum taxonomy when adding a topic from within a forum.
|
||||
*/
|
||||
function forum_nodeapi_presave($node) {
|
||||
function forum_node_presave($node) {
|
||||
$vid = variable_get('forum_nav_vocabulary', '');
|
||||
$vocabulary = taxonomy_vocabulary_load($vid);
|
||||
if (_forum_nodeapi_check_node_type($node, $vocabulary)) {
|
||||
if (_forum_node_check_node_type($node, $vocabulary)) {
|
||||
// Make sure all fields are set properly:
|
||||
$node->icon = !empty($node->icon) ? $node->icon : '';
|
||||
|
||||
|
@ -293,12 +293,12 @@ function forum_nodeapi_presave($node) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_update().
|
||||
* Implementation of hook_node_update().
|
||||
*/
|
||||
function forum_nodeapi_update($node) {
|
||||
function forum_node_update($node) {
|
||||
$vid = variable_get('forum_nav_vocabulary', '');
|
||||
$vocabulary = taxonomy_vocabulary_load($vid);
|
||||
if (_forum_nodeapi_check_node_type($node, $vocabulary)) {
|
||||
if (_forum_node_check_node_type($node, $vocabulary)) {
|
||||
if (empty($node->revision) && db_result(db_query('SELECT tid FROM {forum} WHERE nid=%d', $node->nid))) {
|
||||
if (!empty($node->tid)) {
|
||||
db_query('UPDATE {forum} SET tid = %d WHERE vid = %d', $node->tid, $node->vid);
|
||||
|
@ -317,12 +317,12 @@ function forum_nodeapi_update($node) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_insert().
|
||||
* Implementation of hook_node_insert().
|
||||
*/
|
||||
function forum_nodeapi_insert($node) {
|
||||
function forum_node_insert($node) {
|
||||
$vid = variable_get('forum_nav_vocabulary', '');
|
||||
$vocabulary = taxonomy_vocabulary_load($vid);
|
||||
if (_forum_nodeapi_check_node_type($node, $vocabulary)) {
|
||||
if (_forum_node_check_node_type($node, $vocabulary)) {
|
||||
if (!empty($node->tid)) {
|
||||
db_query('INSERT INTO {forum} (tid, vid, nid) VALUES (%d, %d, %d)', $node->tid, $node->vid, $node->nid);
|
||||
}
|
||||
|
@ -330,20 +330,20 @@ function forum_nodeapi_insert($node) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_delete().
|
||||
* Implementation of hook_node_delete().
|
||||
*/
|
||||
function forum_nodeapi_delete($node) {
|
||||
function forum_node_delete($node) {
|
||||
$vid = variable_get('forum_nav_vocabulary', '');
|
||||
$vocabulary = taxonomy_vocabulary_load($vid);
|
||||
if (_forum_nodeapi_check_node_type($node, $vocabulary)) {
|
||||
if (_forum_node_check_node_type($node, $vocabulary)) {
|
||||
db_query('DELETE FROM {forum} WHERE nid = %d', $node->nid);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_load().
|
||||
* Implementation of hook_node_load().
|
||||
*/
|
||||
function forum_nodeapi_load($nodes, $types) {
|
||||
function forum_node_load($nodes, $types) {
|
||||
$vid = variable_get('forum_nav_vocabulary', '');
|
||||
// If no forum vocabulary is set up, return.
|
||||
if ($vid == '') {
|
||||
|
|
|
@ -289,9 +289,9 @@ function menu_block_view($delta = '') {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_insert().
|
||||
* Implementation of hook_node_insert().
|
||||
*/
|
||||
function menu_nodeapi_insert(&$node) {
|
||||
function menu_node_insert(&$node) {
|
||||
if (isset($node->menu)) {
|
||||
$item = &$node->menu;
|
||||
if (!empty($item['delete'])) {
|
||||
|
@ -311,9 +311,9 @@ function menu_nodeapi_insert(&$node) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_update().
|
||||
* Implementation of hook_node_update().
|
||||
*/
|
||||
function menu_nodeapi_update(&$node) {
|
||||
function menu_node_update(&$node) {
|
||||
if (isset($node->menu)) {
|
||||
$item = &$node->menu;
|
||||
if (!empty($item['delete'])) {
|
||||
|
@ -333,9 +333,9 @@ function menu_nodeapi_update(&$node) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_delete().
|
||||
* Implementation of hook_node_delete().
|
||||
*/
|
||||
function menu_nodeapi_delete(&$node) {
|
||||
function menu_node_delete(&$node) {
|
||||
// Delete all menu module links that point to this node.
|
||||
$result = db_query("SELECT mlid FROM {menu_links} WHERE link_path = :path AND module = 'menu'", array(':path' => 'node/'. $node->nid));
|
||||
while ($m = db_fetch_array($result)) {
|
||||
|
@ -344,9 +344,9 @@ function menu_nodeapi_delete(&$node) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_prepare().
|
||||
* Implementation of hook_node_prepare().
|
||||
*/
|
||||
function menu_nodeapi_prepare(&$node) {
|
||||
function menu_node_prepare(&$node) {
|
||||
if (empty($node->menu)) {
|
||||
// Prepare the node for the edit form so that $node->menu always exists.
|
||||
$menu_name = variable_get('menu_default_node_menu', 'main-menu');
|
||||
|
|
|
@ -169,7 +169,7 @@ function hook_node_operations() {
|
|||
* @return
|
||||
* None.
|
||||
*/
|
||||
function hook_nodeapi_alter($node, $teaser) {
|
||||
function hook_node_alter($node, $teaser) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -180,7 +180,7 @@ function hook_nodeapi_alter($node, $teaser) {
|
|||
* @return
|
||||
* None.
|
||||
*/
|
||||
function hook_nodeapi_delete($node) {
|
||||
function hook_node_delete($node) {
|
||||
db_query('DELETE FROM {mytable} WHERE nid = %d', $node->nid);
|
||||
}
|
||||
|
||||
|
@ -194,7 +194,7 @@ function hook_nodeapi_delete($node) {
|
|||
* @return
|
||||
* None.
|
||||
*/
|
||||
function hook_nodeapi_delete_revision($node) {
|
||||
function hook_node_delete_revision($node) {
|
||||
db_delete('upload')->condition('vid', $node->vid)->execute();
|
||||
if (!is_array($node->files)) {
|
||||
return;
|
||||
|
@ -212,7 +212,7 @@ function hook_nodeapi_delete_revision($node) {
|
|||
* @return
|
||||
* None.
|
||||
*/
|
||||
function hook_nodeapi_insert($node) {
|
||||
function hook_node_insert($node) {
|
||||
db_query("INSERT INTO {mytable} (nid, extra) VALUES (%d, '%s')", $node->nid, $node->extra);
|
||||
}
|
||||
|
||||
|
@ -233,16 +233,16 @@ function hook_nodeapi_insert($node) {
|
|||
* this may affect the way nodes are returned from the cache in subsequent
|
||||
* calls to the function.
|
||||
*
|
||||
* @see comment_nodeapi_load()
|
||||
* @see taxonomy_nodeapi_load()
|
||||
* @see forum_nodeapi_load()
|
||||
* @see comment_node_load()
|
||||
* @see taxonomy_node_load()
|
||||
* @see forum_node_load()
|
||||
*
|
||||
* @param $nodes
|
||||
* An array of node objects indexed by nid.
|
||||
* @param $types
|
||||
* An array containing the types of the nodes.
|
||||
*/
|
||||
function hook_nodeapi_load($nodes, $types) {
|
||||
function hook_node_load($nodes, $types) {
|
||||
$result = db_query('SELECT nid, foo FROM {mytable} WHERE nid IN(:nids)', array(':nids' => array_keys($nodes)));
|
||||
foreach ($result as $record) {
|
||||
$nodes[$record->nid]->foo = $record->foo;
|
||||
|
@ -257,7 +257,7 @@ function hook_nodeapi_load($nodes, $types) {
|
|||
* @return
|
||||
* None.
|
||||
*/
|
||||
function hook_nodeapi_prepare($node) {
|
||||
function hook_node_prepare($node) {
|
||||
if (!isset($node->comment)) {
|
||||
$node->comment = variable_get("comment_$node->type", COMMENT_NODE_READ_WRITE);
|
||||
}
|
||||
|
@ -274,7 +274,7 @@ function hook_nodeapi_prepare($node) {
|
|||
* @return
|
||||
* None.
|
||||
*/
|
||||
function hook_nodeapi_prepare_translation($node) {
|
||||
function hook_node_prepare_translation($node) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -282,7 +282,7 @@ function hook_nodeapi_prepare_translation($node) {
|
|||
*
|
||||
* The module can return properties to be added to the RSS item generated for
|
||||
* this node. This hook should only be used to add XML elements to the RSS
|
||||
* feed item itself. See comment_nodeapi_rss_item() and upload_nodeapi_rss_item()
|
||||
* feed item itself. See comment_node_rss_item() and upload_node_rss_item()
|
||||
* for examples.
|
||||
*
|
||||
* @param $node
|
||||
|
@ -290,7 +290,7 @@ function hook_nodeapi_prepare_translation($node) {
|
|||
* @return
|
||||
* Extra information to be added to the RSS item.
|
||||
*/
|
||||
function hook_nodeapi_rss_item($node) {
|
||||
function hook_node_rss_item($node) {
|
||||
if ($node->comment != COMMENT_NODE_DISABLED) {
|
||||
return array(array('key' => 'comments', 'value' => url('node/' . $node->nid, array('fragment' => 'comments', 'absolute' => TRUE))));
|
||||
}
|
||||
|
@ -309,7 +309,7 @@ function hook_nodeapi_rss_item($node) {
|
|||
* @return
|
||||
* Extra information to be displayed with search result.
|
||||
*/
|
||||
function hook_nodeapi_search_result($node) {
|
||||
function hook_node_search_result($node) {
|
||||
$comments = db_query('SELECT comment_count FROM {node_comment_statistics} WHERE nid = :nid', array('nid' => $node->nid))->fetchField();
|
||||
return format_plural($comments, '1 comment', '@count comments');
|
||||
}
|
||||
|
@ -324,7 +324,7 @@ function hook_nodeapi_search_result($node) {
|
|||
* @return
|
||||
* None.
|
||||
*/
|
||||
function hook_nodeapi_presave($node) {
|
||||
function hook_node_presave($node) {
|
||||
if ($node->nid && $node->moderate) {
|
||||
// Reset votes when node is updated:
|
||||
$node->score = 0;
|
||||
|
@ -341,7 +341,7 @@ function hook_nodeapi_presave($node) {
|
|||
* @return
|
||||
* None.
|
||||
*/
|
||||
function hook_nodeapi_update($node) {
|
||||
function hook_node_update($node) {
|
||||
db_query("UPDATE {mytable} SET extra = '%s' WHERE nid = %d", $node->extra, $node->nid);
|
||||
}
|
||||
|
||||
|
@ -349,14 +349,14 @@ function hook_nodeapi_update($node) {
|
|||
* The node is being indexed.
|
||||
*
|
||||
* If you want additional information to be indexed which is not already
|
||||
* visible through nodeapi "view", then you should return it here.
|
||||
* visible through node "view", then you should return it here.
|
||||
*
|
||||
* @param $node
|
||||
* The node the action is being performed on.
|
||||
* @return
|
||||
* Array of additional information to be indexed.
|
||||
*/
|
||||
function hook_nodeapi_update_index($node) {
|
||||
function hook_node_update_index($node) {
|
||||
$text = '';
|
||||
$comments = db_query('SELECT subject, comment, format FROM {comment} WHERE nid = :nid AND status = :status', array(':nid' => $node->nid, ':status' => COMMENT_PUBLISHED));
|
||||
foreach ($comments as $comment) {
|
||||
|
@ -378,7 +378,7 @@ function hook_nodeapi_update_index($node) {
|
|||
* @return
|
||||
* None.
|
||||
*/
|
||||
function hook_nodeapi_validate($node, $form) {
|
||||
function hook_node_validate($node, $form) {
|
||||
if (isset($node->end) && isset($node->start)) {
|
||||
if ($node->start > $node->end) {
|
||||
form_set_error('time', t('An event may not end before it starts.'));
|
||||
|
@ -400,7 +400,7 @@ function hook_nodeapi_validate($node, $form) {
|
|||
* @return
|
||||
* None.
|
||||
*/
|
||||
function hook_nodeapi_view($node, $teaser) {
|
||||
function hook_node_view($node, $teaser) {
|
||||
$node->content['my_additional_field'] = array(
|
||||
'#value' => $additional_field,
|
||||
'#weight' => 10,
|
||||
|
@ -558,7 +558,7 @@ function hook_access($op, $node, $account) {
|
|||
* None.
|
||||
*
|
||||
* To take action when nodes of any type are deleted (not just nodes of
|
||||
* the type defined by this module), use hook_nodeapi() instead.
|
||||
* the type defined by this module), use hook_node() instead.
|
||||
*
|
||||
* For a detailed usage example, see node_example.module.
|
||||
*/
|
||||
|
@ -665,7 +665,7 @@ function hook_form(&$node, $form_state) {
|
|||
* None.
|
||||
*
|
||||
* To take action when nodes of any type are inserted (not just nodes of
|
||||
* the type(s) defined by this module), use hook_nodeapi() instead.
|
||||
* the type(s) defined by this module), use hook_node() instead.
|
||||
*
|
||||
* For a detailed usage example, see node_example.module.
|
||||
*/
|
||||
|
@ -709,7 +709,7 @@ function hook_load($nodes) {
|
|||
* None.
|
||||
*
|
||||
* To take action when nodes of any type are updated (not just nodes of
|
||||
* the type(s) defined by this module), use hook_nodeapi() instead.
|
||||
* the type(s) defined by this module), use hook_node() instead.
|
||||
*
|
||||
* For a detailed usage example, see node_example.module.
|
||||
*/
|
||||
|
@ -733,11 +733,11 @@ function hook_update($node) {
|
|||
* None.
|
||||
*
|
||||
* To validate nodes of all types (not just nodes of the type(s) defined by
|
||||
* this module), use hook_nodeapi() instead.
|
||||
* this module), use hook_node() instead.
|
||||
*
|
||||
* Changes made to the $node object within a hook_validate() function will
|
||||
* have no effect. The preferred method to change a node's content is to use
|
||||
* hook_submit() or hook_nodeapi($op='submit') instead. If it is really
|
||||
* hook_submit() or hook_node($op='submit') instead. If it is really
|
||||
* necessary to change the node at the validate stage, you can use function
|
||||
* form_set_value().
|
||||
*
|
||||
|
@ -773,7 +773,7 @@ function hook_validate($node, &$form) {
|
|||
* If for some reason you need to change the body or teaser returned by
|
||||
* node_prepare(), you can modify $node->content['body']['#value']. Note
|
||||
* that this will be the un-rendered content. To modify the rendered output,
|
||||
* see hook_nodeapi($op = 'alter').
|
||||
* see hook_node($op = 'alter').
|
||||
*
|
||||
* For a detailed usage example, see node_example.module.
|
||||
*/
|
||||
|
|
|
@ -755,20 +755,20 @@ function node_invoke(&$node, $hook, $a2 = NULL, $a3 = NULL, $a4 = NULL) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Invoke a hook_nodeapi() operation in all modules.
|
||||
* Invoke a hook_node() operation in all modules.
|
||||
*
|
||||
* @param &$node
|
||||
* A node object.
|
||||
* @param $op
|
||||
* A string containing the name of the nodeapi operation.
|
||||
* A string containing the name of the node operation.
|
||||
* @param $a3, $a4
|
||||
* Arguments to pass on to the hook, after the $node and $op arguments.
|
||||
* @return
|
||||
* The returned value of the invoked hooks.
|
||||
*/
|
||||
function node_invoke_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
|
||||
function node_invoke_node(&$node, $op, $a3 = NULL, $a4 = NULL) {
|
||||
$return = array();
|
||||
$hook = 'nodeapi_' . $op;
|
||||
$hook = 'node_' . $op;
|
||||
foreach (module_implements($hook) as $module) {
|
||||
$function = $module . '_' . $hook;
|
||||
$result = $function($node, $a3, $a4);
|
||||
|
@ -892,7 +892,7 @@ function node_load_multiple($nids = array(), $conditions = array(), $reset = FAL
|
|||
}
|
||||
|
||||
// Pass all nodes loaded from the database through the node type specific
|
||||
// callbacks and hook_nodeapi_load(), then add them to the internal cache.
|
||||
// callbacks and hook_node_load(), then add them to the internal cache.
|
||||
if (!empty($queried_nodes)) {
|
||||
// Create an array of nodes for each content type and pass this to the
|
||||
// node type specific callback.
|
||||
|
@ -917,10 +917,10 @@ function node_load_multiple($nids = array(), $conditions = array(), $reset = FAL
|
|||
field_attach_load('node', $queried_nodes);
|
||||
}
|
||||
|
||||
// Call hook_nodeapi_load(), pass the node types so modules can return early
|
||||
// Call hook_node_load(), pass the node types so modules can return early
|
||||
// if not acting on types in the array.
|
||||
foreach (module_implements('nodeapi_load') as $module) {
|
||||
$function = $module . '_nodeapi_load';
|
||||
foreach (module_implements('node_load') as $module) {
|
||||
$function = $module . '_node_load';
|
||||
$function($queried_nodes, array_keys($typed_nodes));
|
||||
}
|
||||
$nodes += $queried_nodes;
|
||||
|
@ -1002,7 +1002,7 @@ function node_validate($node, $form = array()) {
|
|||
|
||||
// Do node-type-specific validation checks.
|
||||
node_invoke($node, 'validate', $form);
|
||||
node_invoke_nodeapi($node, 'validate', $form);
|
||||
node_invoke_node($node, 'validate', $form);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1054,7 +1054,7 @@ function node_submit($node) {
|
|||
function node_save(&$node) {
|
||||
field_attach_presave('node', $node);
|
||||
// Let modules modify the node before it is saved to the database.
|
||||
node_invoke_nodeapi($node, 'presave');
|
||||
node_invoke_node($node, 'presave');
|
||||
global $user;
|
||||
|
||||
$node->is_new = FALSE;
|
||||
|
@ -1133,7 +1133,7 @@ function node_save(&$node) {
|
|||
$function = "field_attach_$op";
|
||||
$function('node', $node);
|
||||
|
||||
node_invoke_nodeapi($node, $op);
|
||||
node_invoke_node($node, $op);
|
||||
|
||||
// Update the node access table for this node.
|
||||
node_access_acquire_grants($node);
|
||||
|
@ -1173,7 +1173,7 @@ function node_delete($nid) {
|
|||
|
||||
// Call the node-specific callback (if any):
|
||||
node_invoke($node, 'delete');
|
||||
node_invoke_nodeapi($node, 'delete');
|
||||
node_invoke_node($node, 'delete');
|
||||
|
||||
// Clear the page and block caches.
|
||||
cache_clear_all();
|
||||
|
@ -1274,7 +1274,7 @@ function node_build_content($node, $teaser = FALSE) {
|
|||
$node->content += field_attach_view('node', $node, $teaser);
|
||||
|
||||
// Allow modules to make their own additions to the node.
|
||||
node_invoke_nodeapi($node, 'view', $teaser);
|
||||
node_invoke_node($node, 'view', $teaser);
|
||||
|
||||
// Allow modules to modify the structured node.
|
||||
drupal_alter('node_build', $node, $teaser);
|
||||
|
@ -1499,11 +1499,11 @@ function node_search($op = 'search', $keys = NULL) {
|
|||
$node->body = drupal_render($node->content);
|
||||
|
||||
// Fetch comments for snippet.
|
||||
$node->body .= module_invoke('comment', 'nodeapi', $node, 'update_index');
|
||||
$node->body .= module_invoke('comment', 'node', $node, 'update_index');
|
||||
// Fetch terms for snippet.
|
||||
$node->body .= module_invoke('taxonomy', 'nodeapi', $node, 'update_index');
|
||||
$node->body .= module_invoke('taxonomy', 'node', $node, 'update_index');
|
||||
|
||||
$extra = node_invoke_nodeapi($node, 'search_result');
|
||||
$extra = node_invoke_node($node, 'search_result');
|
||||
|
||||
$results[] = array(
|
||||
'link' => url('node/' . $item->sid, array('absolute' => TRUE)),
|
||||
|
@ -1933,7 +1933,7 @@ function node_feed($nids = FALSE, $channel = array()) {
|
|||
}
|
||||
|
||||
// Allow modules to change $node->content before the node is rendered.
|
||||
node_invoke_nodeapi($item, 'view', $teaser, FALSE);
|
||||
node_invoke_node($item, 'view', $teaser, FALSE);
|
||||
|
||||
// Set the proper node property, then unset unused $node property so that a
|
||||
// bad theme can not open a security hole.
|
||||
|
@ -1948,11 +1948,11 @@ function node_feed($nids = FALSE, $channel = array()) {
|
|||
}
|
||||
|
||||
// Allow modules to modify the fully-built node.
|
||||
node_invoke_nodeapi($item, 'alter', $teaser, FALSE);
|
||||
node_invoke_node($item, 'alter', $teaser, FALSE);
|
||||
}
|
||||
|
||||
// Allow modules to add additional item fields and/or modify $item
|
||||
$extra = node_invoke_nodeapi($item, 'rss_item');
|
||||
$extra = node_invoke_node($item, 'rss_item');
|
||||
$extra = array_merge($extra, array(array('key' => 'pubDate', 'value' => gmdate('r', $item->created)), array('key' => 'dc:creator', 'value' => $item->name), array('key' => 'guid', 'value' => $item->nid . ' at ' . $base_url, 'attributes' => array('isPermaLink' => 'false'))));
|
||||
foreach ($extra as $element) {
|
||||
if (isset($element['namespace'])) {
|
||||
|
@ -2110,7 +2110,7 @@ function _node_index_node($node) {
|
|||
$text = '<h1>' . check_plain($node->title) . '</h1>' . $node->body;
|
||||
|
||||
// Fetch extra data normally not visible
|
||||
$extra = node_invoke_nodeapi($node, 'update_index');
|
||||
$extra = node_invoke_node($node, 'update_index');
|
||||
foreach ($extra as $t) {
|
||||
$text .= $t;
|
||||
}
|
||||
|
@ -2834,7 +2834,7 @@ function theme_node_submitted($node) {
|
|||
function node_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'),
|
||||
),
|
||||
|
@ -2866,7 +2866,7 @@ function node_action_info() {
|
|||
'configurable' => FALSE,
|
||||
'behavior' => array('changes_node_property'),
|
||||
'hooks' => array(
|
||||
'nodeapi' => array('presave'),
|
||||
'node' => array('presave'),
|
||||
'comment' => array('insert', 'update'),
|
||||
),
|
||||
),
|
||||
|
@ -2876,7 +2876,7 @@ function node_action_info() {
|
|||
'configurable' => FALSE,
|
||||
'behavior' => array('changes_node_property'),
|
||||
'hooks' => array(
|
||||
'nodeapi' => array('presave'),
|
||||
'node' => array('presave'),
|
||||
'comment' => array('delete', 'insert', 'update'),
|
||||
),
|
||||
),
|
||||
|
@ -2886,7 +2886,7 @@ function node_action_info() {
|
|||
'configurable' => FALSE,
|
||||
'behavior' => array('changes_node_property'),
|
||||
'hooks' => array(
|
||||
'nodeapi' => array('presave'),
|
||||
'node' => array('presave'),
|
||||
'comment' => array('insert', 'update'),
|
||||
),
|
||||
),
|
||||
|
@ -2896,7 +2896,7 @@ function node_action_info() {
|
|||
'configurable' => FALSE,
|
||||
'behavior' => array('changes_node_property'),
|
||||
'hooks' => array(
|
||||
'nodeapi' => array('presave'),
|
||||
'node' => array('presave'),
|
||||
'comment' => array('delete', 'insert', 'update'),
|
||||
),
|
||||
),
|
||||
|
@ -2906,7 +2906,7 @@ function node_action_info() {
|
|||
'configurable' => FALSE,
|
||||
'behavior' => array('changes_node_property'),
|
||||
'hooks' => array(
|
||||
'nodeapi' => array('presave'),
|
||||
'node' => array('presave'),
|
||||
'comment' => array('insert', 'update'),
|
||||
),
|
||||
),
|
||||
|
@ -2916,7 +2916,7 @@ function node_action_info() {
|
|||
'configurable' => FALSE,
|
||||
'behavior' => array('changes_node_property'),
|
||||
'hooks' => array(
|
||||
'nodeapi' => array('presave'),
|
||||
'node' => array('presave'),
|
||||
'comment' => array('delete', 'insert', 'update'),
|
||||
),
|
||||
),
|
||||
|
@ -2927,7 +2927,7 @@ function node_action_info() {
|
|||
'behavior' => array('changes_node_property'),
|
||||
'hooks' => array(
|
||||
'any' => TRUE,
|
||||
'nodeapi' => array('presave'),
|
||||
'node' => array('presave'),
|
||||
'comment' => array('delete', 'insert', 'update'),
|
||||
),
|
||||
),
|
||||
|
@ -2944,7 +2944,7 @@ function node_action_info() {
|
|||
'description' => t('Unpublish post containing keyword(s)'),
|
||||
'configurable' => TRUE,
|
||||
'hooks' => array(
|
||||
'nodeapi' => array('presave', 'insert', 'update'),
|
||||
'node' => array('presave', 'insert', 'update'),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
|
|
@ -90,7 +90,7 @@ function node_object_prepare(&$node) {
|
|||
$node->revision = in_array('revision', $node_options);
|
||||
|
||||
node_invoke($node, 'prepare');
|
||||
node_invoke_nodeapi($node, 'prepare');
|
||||
node_invoke_node($node, 'prepare');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -584,7 +584,7 @@ function node_revision_delete_confirm($form_state, $node_revision) {
|
|||
function node_revision_delete_confirm_submit($form, &$form_state) {
|
||||
$node_revision = $form['#node_revision'];
|
||||
db_query("DELETE FROM {node_revision} WHERE nid = %d AND vid = %d", $node_revision->nid, $node_revision->vid);
|
||||
node_invoke_nodeapi($node_revision, 'delete_revision');
|
||||
node_invoke_node($node_revision, 'delete_revision');
|
||||
watchdog('content', '@type: deleted %title revision %revision.', array('@type' => $node_revision->type, '%title' => $node_revision->title, '%revision' => $node_revision->vid));
|
||||
drupal_set_message(t('Revision from %revision-date of @type %title has been deleted.', array('%revision-date' => format_date($node_revision->revision_timestamp), '@type' => node_get_types('name', $node_revision), '%title' => $node_revision->title)));
|
||||
$form_state['redirect'] = 'node/' . $node_revision->nid;
|
||||
|
|
|
@ -617,7 +617,7 @@ class NodeRSSContentTestCase extends DrupalWebTestCase {
|
|||
}
|
||||
|
||||
function setUp() {
|
||||
// Enable dummy module that implements hook_nodeapi_view.
|
||||
// Enable dummy module that implements hook_node_view.
|
||||
parent::setUp('node_test');
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
/**
|
||||
* When the module is enabled, text will be added to all nodes in all build modes.
|
||||
*/
|
||||
function node_test_nodeapi_view($node, $teaser) {
|
||||
function node_test_node_view($node, $teaser) {
|
||||
$node->content['node_test_extra_field'] = array(
|
||||
'#markup' => '<p>' . t('Extra test data added to node !nid.', array('!nid' => $node->nid)) . '</p>',
|
||||
'#weight' => 10,
|
||||
|
|
|
@ -118,9 +118,9 @@ function path_set_alias($path = NULL, $alias = NULL, $pid = NULL, $language = ''
|
|||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_validate().
|
||||
* Implementation of hook_node_validate().
|
||||
*/
|
||||
function path_nodeapi_validate($node, $form) {
|
||||
function path_node_validate($node, $form) {
|
||||
if (user_access('create url aliases') || user_access('administer url aliases')) {
|
||||
if (isset($node->path)) {
|
||||
$language = isset($node->language) ? $node->language : '';
|
||||
|
@ -133,9 +133,9 @@ function path_nodeapi_validate($node, $form) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_load().
|
||||
* Implementation of hook_node_load().
|
||||
*/
|
||||
function path_nodeapi_load($nodes, $types) {
|
||||
function path_node_load($nodes, $types) {
|
||||
foreach ($nodes as $node) {
|
||||
$language = isset($node->language) ? $node->language : '';
|
||||
$path = 'node/' . $node->nid;
|
||||
|
@ -147,9 +147,9 @@ function path_nodeapi_load($nodes, $types) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_insert().
|
||||
* Implementation of hook_node_insert().
|
||||
*/
|
||||
function path_nodeapi_insert($node) {
|
||||
function path_node_insert($node) {
|
||||
if (user_access('create url aliases') || user_access('administer url aliases')) {
|
||||
$language = isset($node->language) ? $node->language : '';
|
||||
// Don't try to insert if path is NULL. We may have already set
|
||||
|
@ -161,9 +161,9 @@ function path_nodeapi_insert($node) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_update().
|
||||
* Implementation of hook_node_update().
|
||||
*/
|
||||
function path_nodeapi_update($node) {
|
||||
function path_node_update($node) {
|
||||
if (user_access('create url aliases') || user_access('administer url aliases')) {
|
||||
$language = isset($node->language) ? $node->language : '';
|
||||
path_set_alias('node/' . $node->nid, isset($node->path) ? $node->path : NULL, isset($node->pid) ? $node->pid : NULL, $language);
|
||||
|
@ -171,9 +171,9 @@ function path_nodeapi_update($node) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_delete().
|
||||
* Implementation of hook_node_delete().
|
||||
*/
|
||||
function path_nodeapi_delete($node) {
|
||||
function path_node_delete($node) {
|
||||
if (user_access('create url aliases') || user_access('administer url aliases')) {
|
||||
$language = isset($node->language) ? $node->language : '';
|
||||
$path = 'node/' . $node->nid;
|
||||
|
|
|
@ -173,11 +173,11 @@ function hook_search($op = 'search', $keys = null) {
|
|||
$node->body = drupal_render($node->content);
|
||||
|
||||
// Fetch comments for snippet.
|
||||
$node->body .= module_invoke('comment', 'nodeapi', $node, 'update_index');
|
||||
$node->body .= module_invoke('comment', 'node', $node, 'update_index');
|
||||
// Fetch terms for snippet.
|
||||
$node->body .= module_invoke('taxonomy', 'nodeapi', $node, 'update_index');
|
||||
$node->body .= module_invoke('taxonomy', 'node', $node, 'update_index');
|
||||
|
||||
$extra = node_invoke_nodeapi($node, 'search_result');
|
||||
$extra = node_invoke_node($node, 'search_result');
|
||||
|
||||
$results[] = array(
|
||||
'link' => url('node/' . $item->sid, array('absolute' => TRUE)),
|
||||
|
@ -265,12 +265,12 @@ function hook_update_index() {
|
|||
$node = node_prepare($node, false);
|
||||
}
|
||||
// Allow modules to change $node->body before viewing.
|
||||
node_invoke_nodeapi($node, 'view', false, false);
|
||||
node_invoke_node($node, 'view', false, false);
|
||||
|
||||
$text = '<h1>' . drupal_specialchars($node->title) . '</h1>' . $node->body;
|
||||
|
||||
// Fetch extra data normally not visible
|
||||
$extra = node_invoke_nodeapi($node, 'update_index');
|
||||
$extra = node_invoke_node($node, 'update_index');
|
||||
foreach ($extra as $t) {
|
||||
$text .= $t;
|
||||
}
|
||||
|
|
|
@ -637,9 +637,9 @@ function search_touch_node($nid) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_update_index().
|
||||
* Implementation of hook_node_update_index().
|
||||
*/
|
||||
function search_nodeapi_update_index($node) {
|
||||
function search_node_update_index($node) {
|
||||
// Transplant links to a node into the target node.
|
||||
$result = db_query("SELECT caption FROM {search_node_links} WHERE nid = %d", $node->nid);
|
||||
$output = array();
|
||||
|
@ -650,9 +650,9 @@ function search_nodeapi_update_index($node) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_update().
|
||||
* Implementation of hook_node_update().
|
||||
*/
|
||||
function search_nodeapi_update($node) {
|
||||
function search_node_update($node) {
|
||||
// Reindex the node when it is updated. The node is automatically indexed
|
||||
// when it is added, simply by being added to the node table.
|
||||
search_touch_node($node->nid);
|
||||
|
@ -1021,10 +1021,10 @@ function search_get_keys() {
|
|||
* for all of the search features to work.
|
||||
*
|
||||
* There are three ways to interact with the search system:
|
||||
* - Specifically for searching nodes, you can implement nodeapi('update_index')
|
||||
* and nodeapi('search_result'). However, note that the search system already
|
||||
* - Specifically for searching nodes, you can implement node('update_index')
|
||||
* and node('search_result'). However, note that the search system already
|
||||
* indexes all visible output of a node, i.e. everything displayed normally
|
||||
* by hook_view() and hook_nodeapi('view'). This is usually sufficient.
|
||||
* by hook_view() and hook_node('view'). This is usually sufficient.
|
||||
* You should only use this mechanism if you want additional, non-visible data
|
||||
* to be indexed.
|
||||
* - Implement hook_search(). This will create a search tab for your module on
|
||||
|
|
|
@ -99,9 +99,9 @@ function statistics_perm() {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_view().
|
||||
* Implementation of hook_node_view().
|
||||
*/
|
||||
function statistics_nodeapi_view($node, $teaser, $page) {
|
||||
function statistics_node_view($node, $teaser, $page) {
|
||||
global $id;
|
||||
$links = array();
|
||||
|
||||
|
@ -341,9 +341,9 @@ function _statistics_format_item($title, $path) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_delete().
|
||||
* Implementation of hook_node_delete().
|
||||
*/
|
||||
function statistics_nodeapi_delete($node) {
|
||||
function statistics_node_delete($node) {
|
||||
// clean up statistics table when node is deleted
|
||||
db_query('DELETE FROM {node_counter} WHERE nid = %d', $node->nid);
|
||||
}
|
||||
|
|
|
@ -1598,7 +1598,7 @@ function system_action_info() {
|
|||
'description' => t('Display a message to the user'),
|
||||
'configurable' => TRUE,
|
||||
'hooks' => array(
|
||||
'nodeapi' => array('view', 'insert', 'update', 'delete'),
|
||||
'node' => array('view', 'insert', 'update', 'delete'),
|
||||
'comment' => array('view', 'insert', 'update', 'delete'),
|
||||
'user' => array('view', 'insert', 'update', 'delete', 'login'),
|
||||
'taxonomy' => array('insert', 'update', 'delete'),
|
||||
|
@ -1609,7 +1609,7 @@ function system_action_info() {
|
|||
'type' => 'system',
|
||||
'configurable' => TRUE,
|
||||
'hooks' => array(
|
||||
'nodeapi' => array('view', 'insert', 'update', 'delete'),
|
||||
'node' => array('view', 'insert', 'update', 'delete'),
|
||||
'comment' => array('view', 'insert', 'update', 'delete'),
|
||||
'user' => array('view', 'insert', 'update', 'delete', 'login'),
|
||||
'taxonomy' => array('insert', 'update', 'delete'),
|
||||
|
@ -1626,7 +1626,7 @@ function system_action_info() {
|
|||
'type' => 'system',
|
||||
'configurable' => TRUE,
|
||||
'hooks' => array(
|
||||
'nodeapi' => array('view', 'insert', 'update', 'delete'),
|
||||
'node' => array('view', 'insert', 'update', 'delete'),
|
||||
'comment' => array('view', 'insert', 'update', 'delete'),
|
||||
'user' => array('view', 'insert', 'update', 'delete', 'login'),
|
||||
)
|
||||
|
@ -1979,7 +1979,7 @@ function system_send_email_action($object, $context) {
|
|||
global $user;
|
||||
|
||||
switch ($context['hook']) {
|
||||
case 'nodeapi':
|
||||
case 'node':
|
||||
// Because this is not an action of type 'node' the node
|
||||
// will not be passed as $object, but it will still be available
|
||||
// in $context.
|
||||
|
@ -2109,7 +2109,7 @@ function system_message_action(&$object, $context = array()) {
|
|||
// are used a node object must be present to be the source
|
||||
// of substituted text.
|
||||
switch ($context['hook']) {
|
||||
case 'nodeapi':
|
||||
case 'node':
|
||||
// Because this is not an action of type 'node' the node
|
||||
// will not be passed as $object, but it will still be available
|
||||
// in $context.
|
||||
|
|
|
@ -36,9 +36,9 @@ function taxonomy_theme() {
|
|||
}
|
||||
|
||||
/**
|
||||
* An implementation of hook_nodeapi_view().
|
||||
* An implementation of hook_node_view().
|
||||
*/
|
||||
function taxonomy_nodeapi_view($node) {
|
||||
function taxonomy_node_view($node) {
|
||||
$links = array();
|
||||
// If previewing, the terms must be converted to objects first.
|
||||
if (isset($node->build_mode) && $node->build_mode == NODE_BUILD_PREVIEW) {
|
||||
|
@ -656,7 +656,7 @@ function taxonomy_node_get_terms($node, $key = 'tid') {
|
|||
*/
|
||||
function taxonomy_node_save($node, $terms) {
|
||||
|
||||
taxonomy_nodeapi_delete_revision($node);
|
||||
taxonomy_node_delete_revision($node);
|
||||
|
||||
// Free tagging vocabularies do not send their tids in the form,
|
||||
// so we'll detect them here and process them independently.
|
||||
|
@ -1258,9 +1258,9 @@ function taxonomy_select_nodes($tids = array(), $operator = 'or', $depth = 0, $p
|
|||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_load().
|
||||
* Implementation of hook_node_load().
|
||||
*/
|
||||
function taxonomy_nodeapi_load($nodes) {
|
||||
function taxonomy_node_load($nodes) {
|
||||
// Get an array of tid, vid associations ordered by vocabulary and term
|
||||
// weight.
|
||||
$tids = taxonomy_get_tids_from_nodes($nodes);
|
||||
|
@ -1284,47 +1284,47 @@ function taxonomy_nodeapi_load($nodes) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_insert().
|
||||
* Implementation of hook_node_insert().
|
||||
*/
|
||||
function taxonomy_nodeapi_insert($node) {
|
||||
function taxonomy_node_insert($node) {
|
||||
if (!empty($node->taxonomy)) {
|
||||
taxonomy_node_save($node, $node->taxonomy);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_update().
|
||||
* Implementation of hook_node_update().
|
||||
*/
|
||||
function taxonomy_nodeapi_update($node) {
|
||||
function taxonomy_node_update($node) {
|
||||
if (!empty($node->taxonomy)) {
|
||||
taxonomy_node_save($node, $node->taxonomy);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_delete().
|
||||
* Implementation of hook_node_delete().
|
||||
*
|
||||
* Remove associations of a node to its terms.
|
||||
*/
|
||||
function taxonomy_nodeapi_delete($node) {
|
||||
function taxonomy_node_delete($node) {
|
||||
db_query('DELETE FROM {taxonomy_term_node} WHERE nid = %d', $node->nid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_delete_revision().
|
||||
* Implementation of hook_node_delete_revision().
|
||||
*
|
||||
* Remove associations of a node to its terms.
|
||||
*/
|
||||
function taxonomy_nodeapi_delete_revision($node) {
|
||||
function taxonomy_node_delete_revision($node) {
|
||||
db_query('DELETE FROM {taxonomy_term_node} WHERE vid = %d', $node->vid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_validate().
|
||||
* Implementation of hook_node_validate().
|
||||
*
|
||||
* Make sure incoming vids are free tagging enabled.
|
||||
*/
|
||||
function taxonomy_nodeapi_validate($node, $form) {
|
||||
function taxonomy_node_validate($node, $form) {
|
||||
if (!empty($node->taxonomy)) {
|
||||
$terms = $node->taxonomy;
|
||||
if (!empty($terms['tags'])) {
|
||||
|
@ -1341,11 +1341,11 @@ function taxonomy_nodeapi_validate($node, $form) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_rss_item().
|
||||
* Implementation of hook_node_rss_item().
|
||||
*
|
||||
* Provides category information for RSS feeds.
|
||||
*/
|
||||
function taxonomy_nodeapi_rss_item($node) {
|
||||
function taxonomy_node_rss_item($node) {
|
||||
$output = array();
|
||||
foreach ($node->taxonomy as $term) {
|
||||
$output[] = array(
|
||||
|
@ -1358,9 +1358,9 @@ function taxonomy_nodeapi_rss_item($node) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_update_index().
|
||||
* Implementation of hook_node_update_index().
|
||||
*/
|
||||
function taxonomy_nodeapi_update_index($node) {
|
||||
function taxonomy_node_update_index($node) {
|
||||
$output = array();
|
||||
foreach ($node->taxonomy as $term) {
|
||||
$output[] = $term->name;
|
||||
|
|
|
@ -401,7 +401,7 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test that hook_nodeapi_$op implementations work correctly.
|
||||
* Test that hook_node_$op implementations work correctly.
|
||||
*
|
||||
* Save & edit a node and assert that taxonomy terms are saved/loaded properly.
|
||||
*/
|
||||
|
|
|
@ -162,12 +162,12 @@ function translation_form_alter(&$form, &$form_state, $form_id) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_view().
|
||||
* Implementation of hook_node_view().
|
||||
*
|
||||
* Display translation links with native language names, if this node
|
||||
* is part of a translation set.
|
||||
*/
|
||||
function translation_nodeapi_view(&$node, $teaser = FALSE) {
|
||||
function translation_node_view(&$node, $teaser = FALSE) {
|
||||
if (isset($node->tnid) && $translations = translation_node_get_translations($node->tnid)) {
|
||||
// Do not show link to the same node.
|
||||
unset($translations[$node->language]);
|
||||
|
@ -190,9 +190,9 @@ function translation_nodeapi_view(&$node, $teaser = FALSE) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_prepare().
|
||||
* Implementation of hook_node_prepare().
|
||||
*/
|
||||
function translation_nodeapi_prepare($node) {
|
||||
function translation_node_prepare($node) {
|
||||
// Only act if we are dealing with a content type supporting translations.
|
||||
if (translation_supported_type($node->type)) {
|
||||
if (empty($node->nid) && isset($_GET['translation']) && isset($_GET['language']) &&
|
||||
|
@ -205,15 +205,15 @@ function translation_nodeapi_prepare($node) {
|
|||
$node->title = $node->translation_source->title;
|
||||
$node->body = $node->translation_source->body;
|
||||
// Let every module add custom translated fields.
|
||||
node_invoke_nodeapi($node, 'prepare_translation');
|
||||
node_invoke_node($node, 'prepare_translation');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_insert().
|
||||
* Implementation of hook_node_insert().
|
||||
*/
|
||||
function translation_nodeapi_insert($node) {
|
||||
function translation_node_insert($node) {
|
||||
// Only act if we are dealing with a content type supporting translations.
|
||||
if (translation_supported_type($node->type)) {
|
||||
if (!empty($node->translation_source)) {
|
||||
|
@ -232,9 +232,9 @@ function translation_nodeapi_insert($node) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_update().
|
||||
* Implementation of hook_node_update().
|
||||
*/
|
||||
function translation_nodeapi_update($node) {
|
||||
function translation_node_update($node) {
|
||||
// Only act if we are dealing with a content type supporting translations.
|
||||
if (translation_supported_type($node->type)) {
|
||||
if (isset($node->translation) && $node->translation && !empty($node->language) && $node->tnid) {
|
||||
|
@ -249,9 +249,9 @@ function translation_nodeapi_update($node) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_delete().
|
||||
* Implementation of hook_node_delete().
|
||||
*/
|
||||
function translation_nodeapi_delete($node) {
|
||||
function translation_node_delete($node) {
|
||||
// Only act if we are dealing with a content type supporting translations.
|
||||
if (translation_supported_type($node->type)) {
|
||||
translation_remove_from_set($node);
|
||||
|
|
|
@ -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'.
|
||||
|
|
|
@ -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'),
|
||||
),
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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.'));
|
||||
|
|
|
@ -58,7 +58,7 @@ function upload_perm() {
|
|||
/**
|
||||
* Inject links into $node for attachments.
|
||||
*/
|
||||
function upload_nodeapi_links($node, $teaser) {
|
||||
function upload_node_links($node, $teaser) {
|
||||
$links = array();
|
||||
|
||||
// Display a link with the number of attachments
|
||||
|
@ -300,9 +300,9 @@ function upload_file_delete($file) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_load().
|
||||
* Implementation of hook_node_load().
|
||||
*/
|
||||
function upload_nodeapi_load($nodes, $types) {
|
||||
function upload_node_load($nodes, $types) {
|
||||
// Collect all the revision ids for nodes with upload enabled.
|
||||
$node_vids = array();
|
||||
foreach ($nodes as $node) {
|
||||
|
@ -338,9 +338,9 @@ function upload_nodeapi_load($nodes, $types) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_view().
|
||||
* Implementation of hook_node_view().
|
||||
*/
|
||||
function upload_nodeapi_view($node, $teaser, $page) {
|
||||
function upload_node_view($node, $teaser, $page) {
|
||||
if (isset($node->files) && user_access('view uploaded files')) {
|
||||
// Add the attachments list to node body with a heavy
|
||||
// weight to ensure they're below other elements.
|
||||
|
@ -353,32 +353,32 @@ function upload_nodeapi_view($node, $teaser, $page) {
|
|||
}
|
||||
}
|
||||
|
||||
upload_nodeapi_links($node, $teaser);
|
||||
upload_node_links($node, $teaser);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_insert().
|
||||
* Implementation of hook_node_insert().
|
||||
*/
|
||||
function upload_nodeapi_insert($node) {
|
||||
function upload_node_insert($node) {
|
||||
if (user_access('upload files')) {
|
||||
upload_save($node);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_update().
|
||||
* Implementation of hook_node_update().
|
||||
*/
|
||||
function upload_nodeapi_update($node) {
|
||||
function upload_node_update($node) {
|
||||
if (user_access('upload files')) {
|
||||
upload_save($node);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_delete().
|
||||
* Implementation of hook_node_delete().
|
||||
*/
|
||||
function upload_nodeapi_delete($node) {
|
||||
function upload_node_delete($node) {
|
||||
db_delete('upload')->condition('nid', $node->nid)->execute();
|
||||
if (!is_array($node->files)) {
|
||||
return;
|
||||
|
@ -389,9 +389,9 @@ function upload_nodeapi_delete($node) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_delete_revision().
|
||||
* Implementation of hook_node_delete_revision().
|
||||
*/
|
||||
function upload_nodeapi_delete_revision($node) {
|
||||
function upload_node_delete_revision($node) {
|
||||
db_delete('upload')->condition('vid', $node->vid)->execute();
|
||||
if (!is_array($node->files)) {
|
||||
return;
|
||||
|
@ -402,16 +402,16 @@ function upload_nodeapi_delete_revision($node) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_search_result().
|
||||
* Implementation of hook_node_search_result().
|
||||
*/
|
||||
function upload_nodeapi_search_result($node) {
|
||||
function upload_node_search_result($node) {
|
||||
return isset($node->files) && is_array($node->files) ? format_plural(count($node->files), '1 attachment', '@count attachments') : NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_nodeapi_rss_item().
|
||||
* Implementation of hook_node_rss_item().
|
||||
*/
|
||||
function upload_nodeapi_rss_item($node) {
|
||||
function upload_node_rss_item($node) {
|
||||
if (is_array($node->files)) {
|
||||
$files = array();
|
||||
foreach ($node->files as $file) {
|
||||
|
|
Loading…
Reference in New Issue