Roll-back of #595084; type-hinting parameters at stdClass makes it so you can't ever pass in another type of class.
parent
370d07e9f7
commit
4d46b7cdf8
|
@ -50,14 +50,14 @@ function blog_help($path, $arg) {
|
|||
/**
|
||||
* Implement hook_form().
|
||||
*/
|
||||
function blog_form(stdClass $node, $form_state) {
|
||||
function blog_form($node, $form_state) {
|
||||
return node_content_form($node, $form_state);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement hook_view().
|
||||
*/
|
||||
function blog_view(stdClass $node, $build_mode) {
|
||||
function blog_view($node, $build_mode) {
|
||||
if ((bool)menu_get_object()) {
|
||||
// Breadcrumb navigation.
|
||||
drupal_set_breadcrumb(array(l(t('Home'), NULL), l(t('Blogs'), 'blog'), l(t("!name's blog", array('!name' => format_username($node))), 'blog/' . $node->uid)));
|
||||
|
@ -68,7 +68,7 @@ function blog_view(stdClass $node, $build_mode) {
|
|||
/**
|
||||
* Implement hook_node_view().
|
||||
*/
|
||||
function blog_node_view(stdClass $node, $build_mode = 'full') {
|
||||
function blog_node_view($node, $build_mode = 'full') {
|
||||
if ($build_mode != 'rss') {
|
||||
if ($node->type == 'blog' && arg(0) != 'blog' || arg(1) != $node->uid) {
|
||||
$links['blog_usernames_blog'] = array(
|
||||
|
|
|
@ -116,7 +116,7 @@ class BlogTestCase extends DrupalWebTestCase {
|
|||
* @param integer $response
|
||||
* HTTP response code.
|
||||
*/
|
||||
private function verifyBlogs($node_user, stdClass $node, $admin, $response = 200) {
|
||||
private function verifyBlogs($node_user, $node, $admin, $response = 200) {
|
||||
$crumb = '›';
|
||||
$quote = ''';
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ function book_admin_settings_validate($form, &$form_state) {
|
|||
*
|
||||
* @ingroup forms.
|
||||
*/
|
||||
function book_admin_edit($form, $form_state, stdClass $node) {
|
||||
function book_admin_edit($form, $form_state, $node) {
|
||||
drupal_set_title($node->title[FIELD_LANGUAGE_NONE][0]['value']);
|
||||
$form['#node'] = $node;
|
||||
_book_admin_table($node, $form);
|
||||
|
@ -151,7 +151,7 @@ function book_admin_edit_submit($form, &$form_state) {
|
|||
*
|
||||
* @see book_admin_edit()
|
||||
*/
|
||||
function _book_admin_table(stdClass $node, &$form) {
|
||||
function _book_admin_table($node, &$form) {
|
||||
$form['table'] = array(
|
||||
'#theme' => 'book_admin_table',
|
||||
'#tree' => TRUE,
|
||||
|
|
|
@ -63,7 +63,7 @@ function book_permission() {
|
|||
/**
|
||||
* Inject links into $node as needed.
|
||||
*/
|
||||
function book_node_view_link(stdClass $node, $build_mode) {
|
||||
function book_node_view_link($node, $build_mode) {
|
||||
$links = array();
|
||||
|
||||
if (isset($node->book['depth'])) {
|
||||
|
@ -177,14 +177,14 @@ function book_menu() {
|
|||
/**
|
||||
* Menu item access callback - determine if the outline tab is accessible.
|
||||
*/
|
||||
function _book_outline_access(stdClass $node) {
|
||||
function _book_outline_access($node) {
|
||||
return user_access('administer book outlines') && node_access('view', $node);
|
||||
}
|
||||
|
||||
/**
|
||||
* Menu item access callback - determine if the user can remove nodes from the outline.
|
||||
*/
|
||||
function _book_outline_remove_access(stdClass $node) {
|
||||
function _book_outline_remove_access($node) {
|
||||
return isset($node->book) && ($node->book['bid'] != $node->nid) && _book_outline_access($node);
|
||||
}
|
||||
|
||||
|
@ -439,7 +439,7 @@ function _book_parent_select($book_link) {
|
|||
/**
|
||||
* Build the common elements of the book form for the node and outline forms.
|
||||
*/
|
||||
function _book_add_form_elements(&$form, stdClass $node) {
|
||||
function _book_add_form_elements(&$form, $node) {
|
||||
// Need this for AJAX.
|
||||
$form['#cache'] = TRUE;
|
||||
|
||||
|
@ -520,7 +520,7 @@ function _book_add_form_elements(&$form, stdClass $node) {
|
|||
* Performs all additions and updates to the book outline through node addition,
|
||||
* node editing, node deletion, or the outline tab.
|
||||
*/
|
||||
function _book_update_outline(stdClass $node) {
|
||||
function _book_update_outline($node) {
|
||||
if (empty($node->book['bid'])) {
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -736,7 +736,7 @@ function book_node_load($nodes, $types) {
|
|||
/**
|
||||
* Implement hook_node_view().
|
||||
*/
|
||||
function book_node_view(stdClass $node, $build_mode) {
|
||||
function book_node_view($node, $build_mode) {
|
||||
if ($build_mode == 'full') {
|
||||
if (!empty($node->book['bid']) && empty($node->in_preview)) {
|
||||
$node->content['book_navigation'] = array(
|
||||
|
@ -768,7 +768,7 @@ function book_page_alter(&$page) {
|
|||
/**
|
||||
* Implement hook_node_presave().
|
||||
*/
|
||||
function book_node_presave(stdClass $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;
|
||||
|
@ -786,7 +786,7 @@ function book_node_presave(stdClass $node) {
|
|||
/**
|
||||
* Implement hook_node_insert().
|
||||
*/
|
||||
function book_node_insert(stdClass $node) {
|
||||
function book_node_insert($node) {
|
||||
if (!empty($node->book['bid'])) {
|
||||
if ($node->book['bid'] == 'new') {
|
||||
// New nodes that are their own book.
|
||||
|
@ -801,7 +801,7 @@ function book_node_insert(stdClass $node) {
|
|||
/**
|
||||
* Implement hook_node_update().
|
||||
*/
|
||||
function book_node_update(stdClass $node) {
|
||||
function book_node_update($node) {
|
||||
if (!empty($node->book['bid'])) {
|
||||
if ($node->book['bid'] == 'new') {
|
||||
// New nodes that are their own book.
|
||||
|
@ -816,7 +816,7 @@ function book_node_update(stdClass $node) {
|
|||
/**
|
||||
* Implement hook_node_delete().
|
||||
*/
|
||||
function book_node_delete(stdClass $node) {
|
||||
function book_node_delete($node) {
|
||||
if (!empty($node->book['bid'])) {
|
||||
if ($node->nid == $node->book['bid']) {
|
||||
// Handle deletion of a top-level post.
|
||||
|
@ -839,7 +839,7 @@ function book_node_delete(stdClass $node) {
|
|||
/**
|
||||
* Implement hook_node_prepare().
|
||||
*/
|
||||
function book_node_prepare(stdClass $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();
|
||||
|
@ -1086,7 +1086,7 @@ function book_export_traverse($tree, $visit_func) {
|
|||
* @return
|
||||
* The HTML generated for the given node.
|
||||
*/
|
||||
function book_node_export(stdClass $node, $children = '') {
|
||||
function book_node_export($node, $children = '') {
|
||||
$build = node_build($node, 'print');
|
||||
unset($build['#theme']);
|
||||
// @todo Rendering should happen in the template using render().
|
||||
|
|
|
@ -89,7 +89,7 @@ function book_export_html($nid) {
|
|||
/**
|
||||
* Menu callback; show the outline form for a single node.
|
||||
*/
|
||||
function book_outline(stdClass $node) {
|
||||
function book_outline($node) {
|
||||
drupal_set_title($node->title[FIELD_LANGUAGE_NONE][0]['value']);
|
||||
return drupal_get_form('book_outline_form', $node);
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ function book_outline(stdClass $node) {
|
|||
*
|
||||
* @ingroup forms
|
||||
*/
|
||||
function book_outline_form($form, &$form_state, stdClass $node) {
|
||||
function book_outline_form($form, &$form_state, $node) {
|
||||
if (!isset($node->book)) {
|
||||
// The node is not part of any book yet - set default options.
|
||||
$node->book = _book_link_defaults($node->nid);
|
||||
|
@ -186,7 +186,7 @@ function book_outline_form_submit($form, &$form_state) {
|
|||
*
|
||||
* @ingroup forms
|
||||
*/
|
||||
function book_remove_form($form, &$form_state, stdClass $node) {
|
||||
function book_remove_form($form, &$form_state, $node) {
|
||||
$form['#node'] = $node;
|
||||
$title = array('%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value']);
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ class BookTestCase extends DrupalWebTestCase {
|
|||
* @param $breadcrumb
|
||||
* The nodes that should be displayed in the breadcrumb.
|
||||
*/
|
||||
function checkBookNode(stdClass $node, $nodes, $previous = FALSE, $up = FALSE, $next = FALSE, array $breadcrumb) {
|
||||
function checkBookNode($node, $nodes, $previous = FALSE, $up = FALSE, $next = FALSE, array $breadcrumb) {
|
||||
// $number does not use drupal_static as it should not be reset
|
||||
// since it uniquely identifies each call to checkBookNode().
|
||||
static $number = 0;
|
||||
|
|
|
@ -423,7 +423,7 @@ function comment_get_recent($number = 10) {
|
|||
* @return
|
||||
* "page=X" if the page number is greater than zero; empty string otherwise.
|
||||
*/
|
||||
function comment_new_page_count($num_comments, $new_replies, stdClass $node) {
|
||||
function comment_new_page_count($num_comments, $new_replies, $node) {
|
||||
$mode = variable_get('comment_default_mode_' . $node->type, COMMENT_MODE_THREADED);
|
||||
$comments_per_page = variable_get('comment_default_per_page_' . $node->type, 50);
|
||||
$pagenum = NULL;
|
||||
|
@ -483,7 +483,7 @@ function theme_comment_block() {
|
|||
/**
|
||||
* Implement hook_node_view().
|
||||
*/
|
||||
function comment_node_view(stdClass $node, $build_mode) {
|
||||
function comment_node_view($node, $build_mode) {
|
||||
$links = array();
|
||||
|
||||
if ($node->comment) {
|
||||
|
@ -589,7 +589,7 @@ function comment_node_view(stdClass $node, $build_mode) {
|
|||
* @param $node
|
||||
* A node object.
|
||||
*/
|
||||
function comment_node_page_additions(stdClass $node) {
|
||||
function comment_node_page_additions($node) {
|
||||
$additions = array();
|
||||
|
||||
// Only attempt to render comments if the node has visible comments.
|
||||
|
@ -690,7 +690,7 @@ function comment_node_page_additions(stdClass $node) {
|
|||
* spoil the reverse ordering, "ORDER BY thread ASC" -- here, we do not need
|
||||
* to consider the trailing "/" so we use a substring only.
|
||||
*/
|
||||
function comment_get_thread(stdClass $node, $mode, $comments_per_page) {
|
||||
function comment_get_thread($node, $mode, $comments_per_page) {
|
||||
$query = db_select('comment', 'c')->extend('PagerDefault');
|
||||
$query->addField('c', 'cid');
|
||||
$query
|
||||
|
@ -780,7 +780,7 @@ function comment_prepare_thread(&$comments) {
|
|||
* @return
|
||||
* An array as expected by drupal_render().
|
||||
*/
|
||||
function comment_build($comment, stdClass $node, $build_mode = 'full') {
|
||||
function comment_build($comment, $node, $build_mode = 'full') {
|
||||
// Populate $comment->content with a render() array.
|
||||
comment_build_content($comment, $node, $build_mode);
|
||||
|
||||
|
@ -836,7 +836,7 @@ function comment_build($comment, stdClass $node, $build_mode = 'full') {
|
|||
* @param $build_mode
|
||||
* Build mode, e.g. 'full', 'teaser'...
|
||||
*/
|
||||
function comment_build_content($comment, stdClass $node, $build_mode = 'full') {
|
||||
function comment_build_content($comment, $node, $build_mode = 'full') {
|
||||
// Remove previously built content, if exists.
|
||||
$comment->content = array();
|
||||
|
||||
|
@ -873,7 +873,7 @@ function comment_build_content($comment, stdClass $node, $build_mode = 'full') {
|
|||
* @return
|
||||
* A structured array of links.
|
||||
*/
|
||||
function comment_links($comment, stdClass $node) {
|
||||
function comment_links($comment, $node) {
|
||||
$links = array();
|
||||
if ($node->comment == COMMENT_NODE_OPEN) {
|
||||
if (user_access('administer comments') && user_access('post comments')) {
|
||||
|
@ -936,7 +936,7 @@ function comment_links($comment, stdClass $node) {
|
|||
* @return
|
||||
* An array in the format expected by drupal_render().
|
||||
*/
|
||||
function comment_build_multiple($comments, stdClass $node, $build_mode = 'full', $weight = 0) {
|
||||
function comment_build_multiple($comments, $node, $build_mode = 'full', $weight = 0) {
|
||||
field_attach_prepare_view('comment', $comments, $build_mode);
|
||||
|
||||
$build = array(
|
||||
|
@ -1122,7 +1122,7 @@ function comment_node_load($nodes, $types) {
|
|||
/**
|
||||
* Implement hook_node_prepare().
|
||||
*/
|
||||
function comment_node_prepare(stdClass $node) {
|
||||
function comment_node_prepare($node) {
|
||||
if (!isset($node->comment)) {
|
||||
$node->comment = variable_get("comment_$node->type", COMMENT_NODE_OPEN);
|
||||
}
|
||||
|
@ -1131,7 +1131,7 @@ function comment_node_prepare(stdClass $node) {
|
|||
/**
|
||||
* Implement hook_node_insert().
|
||||
*/
|
||||
function comment_node_insert(stdClass $node) {
|
||||
function comment_node_insert($node) {
|
||||
db_insert('node_comment_statistics')
|
||||
->fields(array(
|
||||
'nid' => $node->nid,
|
||||
|
@ -1146,7 +1146,7 @@ function comment_node_insert(stdClass $node) {
|
|||
/**
|
||||
* Implement hook_node_delete().
|
||||
*/
|
||||
function comment_node_delete(stdClass $node) {
|
||||
function comment_node_delete($node) {
|
||||
$cids = db_query('SELECT cid FROM {comment} WHERE nid = :nid', array(':nid' => $node->nid))->fetchCol();
|
||||
comment_delete_multiple($cids);
|
||||
db_delete('node_comment_statistics')
|
||||
|
@ -1157,7 +1157,7 @@ function comment_node_delete(stdClass $node) {
|
|||
/**
|
||||
* Implement hook_node_update_index().
|
||||
*/
|
||||
function comment_node_update_index(stdClass $node) {
|
||||
function comment_node_update_index($node) {
|
||||
$text = '';
|
||||
if ($node->comment != COMMENT_NODE_HIDDEN) {
|
||||
$comments = db_query('SELECT subject, comment, format FROM {comment} WHERE nid = :nid AND status = :status', array(
|
||||
|
@ -1182,7 +1182,7 @@ function comment_update_index() {
|
|||
/**
|
||||
* Implement hook_node_search_result().
|
||||
*/
|
||||
function comment_node_search_result(stdClass $node) {
|
||||
function comment_node_search_result($node) {
|
||||
if ($node->comment != COMMENT_NODE_HIDDEN) {
|
||||
$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');
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
* @return
|
||||
* The rendered parent node or comment plus the new comment form.
|
||||
*/
|
||||
function comment_reply(stdClass $node, $pid = NULL) {
|
||||
function comment_reply($node, $pid = NULL) {
|
||||
// Set the breadcrumb trail.
|
||||
drupal_set_breadcrumb(array(l(t('Home'), NULL), l($node->title[FIELD_LANGUAGE_NONE][0]['value'], 'node/' . $node->nid)));
|
||||
$op = isset($_POST['op']) ? $_POST['op'] : '';
|
||||
|
|
|
@ -1271,7 +1271,7 @@ function field_attach_extra_weight($bundle, $pseudo_field) {
|
|||
*
|
||||
* TODO D7: We do not yet know if this really belongs in Field API.
|
||||
*/
|
||||
function field_attach_prepare_translation(stdClass $node) {
|
||||
function field_attach_prepare_translation($node) {
|
||||
// Prevent against invalid 'nodes' built by broken 3rd party code.
|
||||
if (isset($node->type)) {
|
||||
$type = content_types($node->type);
|
||||
|
|
|
@ -151,7 +151,7 @@ function forum_init() {
|
|||
* @return
|
||||
* Boolean indicating if the node can be assigned to a forum.
|
||||
*/
|
||||
function _forum_node_check_node_type(stdClass $node) {
|
||||
function _forum_node_check_node_type($node) {
|
||||
// Fetch information about the forum field.
|
||||
$field = field_info_instance('node', 'taxonomy_forums', $node->type);
|
||||
|
||||
|
@ -161,7 +161,7 @@ function _forum_node_check_node_type(stdClass $node) {
|
|||
/**
|
||||
* Implement hook_node_view().
|
||||
*/
|
||||
function forum_node_view(stdClass $node, $build_mode) {
|
||||
function forum_node_view($node, $build_mode) {
|
||||
$vid = variable_get('forum_nav_vocabulary', 0);
|
||||
$vocabulary = taxonomy_vocabulary_load($vid);
|
||||
if (_forum_node_check_node_type($node)) {
|
||||
|
@ -184,7 +184,7 @@ function forum_node_view(stdClass $node, $build_mode) {
|
|||
/**
|
||||
* Implement hook_node_prepare().
|
||||
*/
|
||||
function forum_node_prepare(stdClass $node) {
|
||||
function forum_node_prepare($node) {
|
||||
if (_forum_node_check_node_type($node)) {
|
||||
if (empty($node->nid)) {
|
||||
// New topic
|
||||
|
@ -198,7 +198,7 @@ function forum_node_prepare(stdClass $node) {
|
|||
*
|
||||
* Check in particular that only a "leaf" term in the associated taxonomy.
|
||||
*/
|
||||
function forum_node_validate(stdClass $node, $form) {
|
||||
function forum_node_validate($node, $form) {
|
||||
if (_forum_node_check_node_type($node)) {
|
||||
$langcode = $form['taxonomy_forums']['#language'];
|
||||
// vocabulary is selected, not a "container" term.
|
||||
|
@ -224,7 +224,7 @@ function forum_node_validate(stdClass $node, $form) {
|
|||
*
|
||||
* Assign forum taxonomy when adding a topic from within a forum.
|
||||
*/
|
||||
function forum_node_presave(stdClass $node) {
|
||||
function forum_node_presave($node) {
|
||||
if (_forum_node_check_node_type($node)) {
|
||||
// Make sure all fields are set properly:
|
||||
$node->icon = !empty($node->icon) ? $node->icon : '';
|
||||
|
@ -243,7 +243,7 @@ function forum_node_presave(stdClass $node) {
|
|||
/**
|
||||
* Implement hook_node_update().
|
||||
*/
|
||||
function forum_node_update(stdClass $node) {
|
||||
function forum_node_update($node) {
|
||||
if (_forum_node_check_node_type($node)) {
|
||||
if (empty($node->revision) && db_query('SELECT tid FROM {forum} WHERE nid=:nid', array(':nid' => $node->nid))->fetchField()) {
|
||||
if (!empty($node->forum_tid)) {
|
||||
|
@ -291,7 +291,7 @@ function forum_node_update(stdClass $node) {
|
|||
/**
|
||||
* Implement hook_node_insert().
|
||||
*/
|
||||
function forum_node_insert(stdClass $node) {
|
||||
function forum_node_insert($node) {
|
||||
if (_forum_node_check_node_type($node)) {
|
||||
if (!empty($node->forum_tid)) {
|
||||
$nid = db_insert('forum')
|
||||
|
@ -308,7 +308,7 @@ function forum_node_insert(stdClass $node) {
|
|||
/**
|
||||
* Implement hook_node_delete().
|
||||
*/
|
||||
function forum_node_delete(stdClass $node) {
|
||||
function forum_node_delete($node) {
|
||||
if (_forum_node_check_node_type($node)) {
|
||||
db_delete('forum')
|
||||
->condition('nid', $node->nid)
|
||||
|
@ -602,7 +602,7 @@ function forum_block_view_pre_render($elements) {
|
|||
/**
|
||||
* Implement hook_form().
|
||||
*/
|
||||
function forum_form(stdClass $node, $form_state) {
|
||||
function forum_form($node, $form_state) {
|
||||
$type = node_type_get_type($node);
|
||||
|
||||
if (!empty($node->nid)) {
|
||||
|
|
|
@ -301,7 +301,7 @@ class ForumTestCase extends DrupalWebTestCase {
|
|||
* @param $response
|
||||
* The exptected HTTP response code.
|
||||
*/
|
||||
private function verifyForums($node_user, stdClass $node, $admin, $response = 200) {
|
||||
private function verifyForums($node_user, $node, $admin, $response = 200) {
|
||||
$crumb = '›';
|
||||
$quote = ''';
|
||||
|
||||
|
|
|
@ -451,21 +451,21 @@ function menu_block_view_alter(&$data, $block) {
|
|||
/**
|
||||
* Implement hook_node_insert().
|
||||
*/
|
||||
function menu_node_insert(stdClass $node) {
|
||||
function menu_node_insert($node) {
|
||||
menu_node_save($node);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement hook_node_update().
|
||||
*/
|
||||
function menu_node_update(stdClass $node) {
|
||||
function menu_node_update($node) {
|
||||
menu_node_save($node);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper for hook_node_insert() and hook_node_update().
|
||||
*/
|
||||
function menu_node_save(stdClass $node) {
|
||||
function menu_node_save($node) {
|
||||
if (isset($node->menu)) {
|
||||
$link = &$node->menu;
|
||||
if (empty($link['enabled'])) {
|
||||
|
@ -490,7 +490,7 @@ function menu_node_save(stdClass $node) {
|
|||
/**
|
||||
* Implement hook_node_delete().
|
||||
*/
|
||||
function menu_node_delete(stdClass $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), array('fetch' => PDO::FETCH_ASSOC));
|
||||
foreach ($result as $m) {
|
||||
|
@ -501,7 +501,7 @@ function menu_node_delete(stdClass $node) {
|
|||
/**
|
||||
* Implement hook_node_prepare().
|
||||
*/
|
||||
function menu_node_prepare(stdClass $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', 'navigation');
|
||||
|
|
|
@ -74,7 +74,7 @@ function hook_node_grants($account, $op) {
|
|||
*
|
||||
* @ingroup node_access
|
||||
*/
|
||||
function hook_node_access_records(stdClass $node) {
|
||||
function hook_node_access_records($node) {
|
||||
if (node_access_example_disabling()) {
|
||||
return;
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ function hook_node_access_records(stdClass $node) {
|
|||
*
|
||||
* @ingroup node_access
|
||||
*/
|
||||
function hook_node_access_records_alter(&$grants, stdClass $node) {
|
||||
function hook_node_access_records_alter(&$grants, $node) {
|
||||
// Our module allows editors to tag specific articles as 'preview'
|
||||
// content using the taxonomy system. If the node being saved
|
||||
// contains one of the preview terms defined in our variable
|
||||
|
@ -265,7 +265,7 @@ function hook_node_operations() {
|
|||
* @param $node
|
||||
* The node that is being deleted.
|
||||
*/
|
||||
function hook_node_delete(stdClass $node) {
|
||||
function hook_node_delete($node) {
|
||||
db_delete('mytable')
|
||||
->condition('nid', $node->nid)
|
||||
->execute();
|
||||
|
@ -279,7 +279,7 @@ function hook_node_delete(stdClass $node) {
|
|||
* @param $node
|
||||
* The node the action is being performed on.
|
||||
*/
|
||||
function hook_node_revision_delete(stdClass $node) {
|
||||
function hook_node_revision_delete($node) {
|
||||
db_delete('upload')->condition('vid', $node->vid)->execute();
|
||||
if (!is_array($node->files)) {
|
||||
return;
|
||||
|
@ -297,7 +297,7 @@ function hook_node_revision_delete(stdClass $node) {
|
|||
* @param $node
|
||||
* The node the action is being performed on.
|
||||
*/
|
||||
function hook_node_insert(stdClass $node) {
|
||||
function hook_node_insert($node) {
|
||||
db_insert('mytable')
|
||||
->fields(array(
|
||||
'nid' => $node->nid,
|
||||
|
@ -406,7 +406,7 @@ function hook_node_access($node, $op, $account) {
|
|||
* @param $node
|
||||
* The node the action is being performed on.
|
||||
*/
|
||||
function hook_node_prepare(stdClass $node) {
|
||||
function hook_node_prepare($node) {
|
||||
if (!isset($node->comment)) {
|
||||
$node->comment = variable_get("comment_$node->type", COMMENT_NODE_OPEN);
|
||||
}
|
||||
|
@ -421,7 +421,7 @@ function hook_node_prepare(stdClass $node) {
|
|||
* @param $node
|
||||
* The node the action is being performed on.
|
||||
*/
|
||||
function hook_node_prepare_translation(stdClass $node) {
|
||||
function hook_node_prepare_translation($node) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -434,7 +434,7 @@ function hook_node_prepare_translation(stdClass $node) {
|
|||
* @return
|
||||
* Extra information to be displayed with search result.
|
||||
*/
|
||||
function hook_node_search_result(stdClass $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');
|
||||
}
|
||||
|
@ -447,7 +447,7 @@ function hook_node_search_result(stdClass $node) {
|
|||
* @param $node
|
||||
* The node the action is being performed on.
|
||||
*/
|
||||
function hook_node_presave(stdClass $node) {
|
||||
function hook_node_presave($node) {
|
||||
if ($node->nid && $node->moderate) {
|
||||
// Reset votes when node is updated:
|
||||
$node->score = 0;
|
||||
|
@ -462,7 +462,7 @@ function hook_node_presave(stdClass $node) {
|
|||
* @param $node
|
||||
* The node the action is being performed on.
|
||||
*/
|
||||
function hook_node_update(stdClass $node) {
|
||||
function hook_node_update($node) {
|
||||
db_update('mytable')
|
||||
->fields(array('extra' => $node->extra))
|
||||
->condition('nid', $node->nid)
|
||||
|
@ -480,7 +480,7 @@ function hook_node_update(stdClass $node) {
|
|||
* @return
|
||||
* Array of additional information to be indexed.
|
||||
*/
|
||||
function hook_node_update_index(stdClass $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) {
|
||||
|
@ -500,7 +500,7 @@ function hook_node_update_index(stdClass $node) {
|
|||
* @param $form
|
||||
* The $form parameter from node_validate().
|
||||
*/
|
||||
function hook_node_validate(stdClass $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.'));
|
||||
|
@ -531,7 +531,7 @@ function hook_node_validate(stdClass $node, $form) {
|
|||
* @param $build_mode
|
||||
* The $build_mode parameter from node_build().
|
||||
*/
|
||||
function hook_node_view(stdClass $node, $build_mode) {
|
||||
function hook_node_view($node, $build_mode) {
|
||||
$node->content['my_additional_field'] = array(
|
||||
'#value' => $additional_field,
|
||||
'#weight' => 10,
|
||||
|
@ -740,7 +740,7 @@ function hook_node_type_delete($info) {
|
|||
*
|
||||
* For a detailed usage example, see node_example.module.
|
||||
*/
|
||||
function hook_delete(stdClass $node) {
|
||||
function hook_delete($node) {
|
||||
db_delete('mytable')
|
||||
->condition('nid', $nid->nid)
|
||||
->execute();
|
||||
|
@ -755,7 +755,7 @@ function hook_delete(stdClass $node) {
|
|||
*
|
||||
* For a usage example, see image.module.
|
||||
*/
|
||||
function hook_prepare(stdClass $node) {
|
||||
function hook_prepare($node) {
|
||||
if ($file = file_check_upload($field_name)) {
|
||||
$file = file_save_upload($field_name, _image_filename($file->filename, NULL, TRUE));
|
||||
if ($file) {
|
||||
|
@ -795,7 +795,7 @@ function hook_prepare(stdClass $node) {
|
|||
*
|
||||
* For a detailed usage example, see node_example.module.
|
||||
*/
|
||||
function hook_form(stdClass $node, $form_state) {
|
||||
function hook_form($node, $form_state) {
|
||||
$type = node_type_get_type($node);
|
||||
|
||||
$form['title'] = array(
|
||||
|
@ -845,7 +845,7 @@ function hook_form(stdClass $node, $form_state) {
|
|||
*
|
||||
* For a detailed usage example, see node_example.module.
|
||||
*/
|
||||
function hook_insert(stdClass $node) {
|
||||
function hook_insert($node) {
|
||||
db_insert('mytable')
|
||||
->fields(array(
|
||||
'nid' => $node->nid,
|
||||
|
@ -891,7 +891,7 @@ function hook_load($nodes) {
|
|||
*
|
||||
* For a detailed usage example, see node_example.module.
|
||||
*/
|
||||
function hook_update(stdClass $node) {
|
||||
function hook_update($node) {
|
||||
db_update('mytable')
|
||||
->fields(array('extra' => $node->extra))
|
||||
->condition('nid', $node->nid)
|
||||
|
@ -920,7 +920,7 @@ function hook_update(stdClass $node) {
|
|||
*
|
||||
* For a detailed usage example, see node_example.module.
|
||||
*/
|
||||
function hook_validate(stdClass $node, &$form) {
|
||||
function hook_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.'));
|
||||
|
@ -953,7 +953,7 @@ function hook_validate(stdClass $node, &$form) {
|
|||
*
|
||||
* For a detailed usage example, see node_example.module.
|
||||
*/
|
||||
function hook_view(stdClass $node, $build_mode = 'full') {
|
||||
function hook_view($node, $build_mode = 'full') {
|
||||
if ((bool)menu_get_object()) {
|
||||
$breadcrumb = array();
|
||||
$breadcrumb[] = array('path' => 'example', 'title' => t('example'));
|
||||
|
|
|
@ -869,7 +869,7 @@ function node_load($nid = NULL, $vid = NULL, $reset = FALSE) {
|
|||
/**
|
||||
* Perform validation checks on the given node.
|
||||
*/
|
||||
function node_validate(stdClass $node, $form = array()) {
|
||||
function node_validate($node, $form = array()) {
|
||||
$type = node_type_get_type($node);
|
||||
|
||||
if (isset($node->nid) && (node_last_changed($node->nid) > $node->changed)) {
|
||||
|
@ -924,7 +924,7 @@ function node_submit($node) {
|
|||
* The $node object to be saved. If $node->nid is
|
||||
* omitted (or $node->is_new is TRUE), a new node will be added.
|
||||
*/
|
||||
function node_save(stdClass $node) {
|
||||
function node_save($node) {
|
||||
field_attach_presave('node', $node);
|
||||
// Let modules modify the node before it is saved to the database.
|
||||
module_invoke_all('node_presave', $node);
|
||||
|
@ -1035,7 +1035,7 @@ function node_save(stdClass $node) {
|
|||
* Node is taken by reference, because drupal_write_record() updates the
|
||||
* $node with the revision id, and we need to pass that back to the caller.
|
||||
*/
|
||||
function _node_save_revision(stdClass $node, $uid, $update = NULL) {
|
||||
function _node_save_revision($node, $uid, $update = NULL) {
|
||||
$temp_uid = $node->uid;
|
||||
$node->uid = $uid;
|
||||
if (isset($update)) {
|
||||
|
@ -1182,7 +1182,7 @@ function node_build($node, $build_mode = 'full') {
|
|||
* @param $build_mode
|
||||
* Build mode, e.g. 'full', 'teaser'...
|
||||
*/
|
||||
function node_build_content(stdClass $node, $build_mode = 'full') {
|
||||
function node_build_content($node, $build_mode = 'full') {
|
||||
// Remove previously built content, if exists.
|
||||
$node->content = array();
|
||||
|
||||
|
@ -1274,7 +1274,7 @@ function node_language_provider($languages) {
|
|||
* @return
|
||||
* A $page element suitable for use by drupal_page_render().
|
||||
*/
|
||||
function node_show(stdClass $node, $message = FALSE) {
|
||||
function node_show($node, $message = FALSE) {
|
||||
if ($message) {
|
||||
drupal_set_title(t('Revision of %title from %date', array('%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'], '%date' => format_date($node->revision_timestamp))), PASS_THROUGH);
|
||||
}
|
||||
|
@ -1689,7 +1689,7 @@ function theme_node_search_admin($variables) {
|
|||
return $output;
|
||||
}
|
||||
|
||||
function _node_revision_access(stdClass $node, $op = 'view') {
|
||||
function _node_revision_access($node, $op = 'view') {
|
||||
$access = &drupal_static(__FUNCTION__, array());
|
||||
if (!isset($access[$node->vid])) {
|
||||
$node_current_revision = node_load($node->nid);
|
||||
|
@ -1929,7 +1929,7 @@ function node_type_page_title($type) {
|
|||
/**
|
||||
* Title callback.
|
||||
*/
|
||||
function node_page_title(stdClass $node) {
|
||||
function node_page_title($node) {
|
||||
return $node->title;
|
||||
}
|
||||
|
||||
|
@ -1958,7 +1958,7 @@ function node_last_changed($nid) {
|
|||
/**
|
||||
* Return a list of all the existing revision numbers.
|
||||
*/
|
||||
function node_revision_list(stdClass $node) {
|
||||
function node_revision_list($node) {
|
||||
$revisions = array();
|
||||
$result = db_query('SELECT r.vid, r.title, r.log, r.uid, n.vid AS current_vid, r.timestamp, u.name FROM {node_revision} r LEFT JOIN {node} n ON n.vid = r.vid INNER JOIN {users} u ON u.uid = r.uid WHERE r.nid = :nid ORDER BY r.timestamp DESC', array(':nid' => $node->nid));
|
||||
foreach ($result as $revision) {
|
||||
|
@ -2151,7 +2151,7 @@ function node_page_default() {
|
|||
/**
|
||||
* Menu callback; view a single node.
|
||||
*/
|
||||
function node_page_view(stdClass $node) {
|
||||
function node_page_view($node) {
|
||||
$return = node_show($node);
|
||||
if (isset($return['nodes'][$node->nid]['title'])) {
|
||||
drupal_set_title($return['nodes'][$node->nid]['title']['items'][0]['#item']['value']);
|
||||
|
@ -2182,7 +2182,7 @@ function node_update_index() {
|
|||
* @param $node
|
||||
* The node to index.
|
||||
*/
|
||||
function _node_index_node(stdClass $node) {
|
||||
function _node_index_node($node) {
|
||||
$node = node_load($node->nid);
|
||||
|
||||
// Save the changed time of the most recent indexed node, for the search
|
||||
|
@ -2686,7 +2686,7 @@ function node_query_node_access_alter(QueryAlterableInterface $query) {
|
|||
* @param $node
|
||||
* The $node to acquire grants for.
|
||||
*/
|
||||
function node_access_acquire_grants(stdClass $node) {
|
||||
function node_access_acquire_grants($node) {
|
||||
$grants = module_invoke_all('node_access_records', $node);
|
||||
// Let modules alter the grants.
|
||||
drupal_alter('node_access_records', $grants, $node);
|
||||
|
@ -2730,7 +2730,7 @@ function node_access_acquire_grants(stdClass $node) {
|
|||
* If false, do not delete records. This is only for optimization purposes,
|
||||
* and assumes the caller has already performed a mass delete of some form.
|
||||
*/
|
||||
function node_access_write_grants(stdClass $node, $grants, $realm = NULL, $delete = TRUE) {
|
||||
function node_access_write_grants($node, $grants, $realm = NULL, $delete = TRUE) {
|
||||
if ($delete) {
|
||||
$query = db_delete('node_access')->condition('nid', $node->nid);
|
||||
if ($realm) {
|
||||
|
@ -2919,7 +2919,7 @@ function _node_access_rebuild_batch_finished($success, $results, $operations) {
|
|||
/**
|
||||
* Implement hook_form().
|
||||
*/
|
||||
function node_content_form(stdClass $node, $form_state) {
|
||||
function node_content_form($node, $form_state) {
|
||||
// It is impossible to define a content type without implementing hook_form()
|
||||
// so simply return an empty array().
|
||||
// @todo: remove this requirement.
|
||||
|
@ -3017,7 +3017,7 @@ function node_action_info() {
|
|||
* Implement a Drupal action.
|
||||
* Sets the status of a node to 1, meaning published.
|
||||
*/
|
||||
function node_publish_action(stdClass $node, $context = array()) {
|
||||
function node_publish_action($node, $context = array()) {
|
||||
$node->status = NODE_PUBLISHED;
|
||||
watchdog('action', 'Set @type %title to published.', array('@type' => node_type_get_name($node), '%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value']));
|
||||
}
|
||||
|
@ -3026,7 +3026,7 @@ function node_publish_action(stdClass $node, $context = array()) {
|
|||
* Implement a Drupal action.
|
||||
* Sets the status of a node to 0, meaning unpublished.
|
||||
*/
|
||||
function node_unpublish_action(stdClass $node, $context = array()) {
|
||||
function node_unpublish_action($node, $context = array()) {
|
||||
$node->status = NODE_NOT_PUBLISHED;
|
||||
watchdog('action', 'Set @type %title to unpublished.', array('@type' => node_type_get_name($node), '%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value']));
|
||||
}
|
||||
|
@ -3035,7 +3035,7 @@ function node_unpublish_action(stdClass $node, $context = array()) {
|
|||
* Implement a Drupal action.
|
||||
* Sets the sticky-at-top-of-list property of a node to 1.
|
||||
*/
|
||||
function node_make_sticky_action(stdClass $node, $context = array()) {
|
||||
function node_make_sticky_action($node, $context = array()) {
|
||||
$node->sticky = NODE_STICKY;
|
||||
watchdog('action', 'Set @type %title to sticky.', array('@type' => node_type_get_name($node), '%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value']));
|
||||
}
|
||||
|
@ -3044,7 +3044,7 @@ function node_make_sticky_action(stdClass $node, $context = array()) {
|
|||
* Implement a Drupal action.
|
||||
* Sets the sticky-at-top-of-list property of a node to 0.
|
||||
*/
|
||||
function node_make_unsticky_action(stdClass $node, $context = array()) {
|
||||
function node_make_unsticky_action($node, $context = array()) {
|
||||
$node->sticky = NODE_NOT_STICKY;
|
||||
watchdog('action', 'Set @type %title to unsticky.', array('@type' => node_type_get_name($node), '%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value']));
|
||||
}
|
||||
|
@ -3053,7 +3053,7 @@ function node_make_unsticky_action(stdClass $node, $context = array()) {
|
|||
* Implement a Drupal action.
|
||||
* Sets the promote property of a node to 1.
|
||||
*/
|
||||
function node_promote_action(stdClass $node, $context = array()) {
|
||||
function node_promote_action($node, $context = array()) {
|
||||
$node->promote = NODE_PROMOTED;
|
||||
watchdog('action', 'Promoted @type %title to front page.', array('@type' => node_type_get_name($node), '%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value']));
|
||||
}
|
||||
|
@ -3062,7 +3062,7 @@ function node_promote_action(stdClass $node, $context = array()) {
|
|||
* Implement a Drupal action.
|
||||
* Sets the promote property of a node to 0.
|
||||
*/
|
||||
function node_unpromote_action(stdClass $node, $context = array()) {
|
||||
function node_unpromote_action($node, $context = array()) {
|
||||
$node->promote = NODE_NOT_PROMOTED;
|
||||
watchdog('action', 'Removed @type %title from front page.', array('@type' => node_type_get_name($node), '%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value']));
|
||||
}
|
||||
|
@ -3071,7 +3071,7 @@ function node_unpromote_action(stdClass $node, $context = array()) {
|
|||
* Implement a Drupal action.
|
||||
* Saves a node.
|
||||
*/
|
||||
function node_save_action(stdClass $node) {
|
||||
function node_save_action($node) {
|
||||
node_save($node);
|
||||
watchdog('action', 'Saved @type %title', array('@type' => node_type_get_name($node), '%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value']));
|
||||
}
|
||||
|
@ -3080,7 +3080,7 @@ function node_save_action(stdClass $node) {
|
|||
* Implement a configurable Drupal action.
|
||||
* Assigns ownership of a node to a user.
|
||||
*/
|
||||
function node_assign_owner_action(stdClass $node, $context) {
|
||||
function node_assign_owner_action($node, $context) {
|
||||
$node->uid = $context['owner_uid'];
|
||||
$owner_name = db_query("SELECT name FROM {users} WHERE uid = :uid", array(':uid' => $context['owner_uid']))->fetchField();
|
||||
watchdog('action', 'Changed owner of @type %title to uid %name.', array('@type' => node_type_get_type($node), '%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'], '%name' => $owner_name));
|
||||
|
@ -3160,7 +3160,7 @@ function node_unpublish_by_keyword_action_submit($form, $form_state) {
|
|||
* An array providing more information about the context of the call to this
|
||||
* action.
|
||||
*/
|
||||
function node_unpublish_by_keyword_action(stdClass $node, $context) {
|
||||
function node_unpublish_by_keyword_action($node, $context) {
|
||||
foreach ($context['keywords'] as $keyword) {
|
||||
if (strpos(drupal_render(node_build(clone $node)), $keyword) !== FALSE || strpos($node->title, $keyword) !== FALSE) {
|
||||
$node->status = NODE_NOT_PUBLISHED;
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
/**
|
||||
* Menu callback; presents the node editing form, or redirects to delete confirmation.
|
||||
*/
|
||||
function node_page_edit(stdClass $node) {
|
||||
function node_page_edit($node) {
|
||||
$type_name = node_type_get_name($node);
|
||||
drupal_set_title(t('<em>Edit @type</em> @title', array('@type' => $type_name, '@title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'])), PASS_THROUGH);
|
||||
return drupal_get_form($node->type . '_node_form', $node);
|
||||
|
@ -80,7 +80,7 @@ function node_form_validate($form, &$form_state) {
|
|||
field_attach_form_validate('node', $node, $form, $form_state);
|
||||
}
|
||||
|
||||
function node_object_prepare(stdClass $node) {
|
||||
function node_object_prepare($node) {
|
||||
// Set up default values, if required.
|
||||
$node_options = variable_get('node_options_' . $node->type, array('status', 'promote'));
|
||||
// If this is a new node, fill in the default values.
|
||||
|
@ -107,7 +107,7 @@ function node_object_prepare(stdClass $node) {
|
|||
/**
|
||||
* Generate the node add/edit form array.
|
||||
*/
|
||||
function node_form($form, &$form_state, stdClass $node) {
|
||||
function node_form($form, &$form_state, $node) {
|
||||
global $user;
|
||||
|
||||
if (isset($form_state['node'])) {
|
||||
|
@ -339,7 +339,7 @@ function theme_node_form($variables) {
|
|||
/**
|
||||
* Generate a node preview.
|
||||
*/
|
||||
function node_preview(stdClass $node) {
|
||||
function node_preview($node) {
|
||||
if (node_access('create', $node) || node_access('update', $node)) {
|
||||
_field_invoke_multiple('load', 'node', array($node->nid => $node));
|
||||
// Load the user's name when needed.
|
||||
|
@ -460,7 +460,7 @@ function node_form_submit_build_node($form, &$form_state) {
|
|||
/**
|
||||
* Menu callback -- ask for confirmation of node deletion
|
||||
*/
|
||||
function node_delete_confirm($form, &$form_state, stdClass $node) {
|
||||
function node_delete_confirm($form, &$form_state, $node) {
|
||||
$form['nid'] = array(
|
||||
'#type' => 'value',
|
||||
'#value' => $node->nid,
|
||||
|
@ -492,7 +492,7 @@ function node_delete_confirm_submit($form, &$form_state) {
|
|||
/**
|
||||
* Generate an overview table of older revisions of a node.
|
||||
*/
|
||||
function node_revision_overview(stdClass $node) {
|
||||
function node_revision_overview($node) {
|
||||
drupal_set_title(t('Revisions for %title', array('%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'])), PASS_THROUGH);
|
||||
|
||||
$header = array(t('Revision'), array('data' => t('Operations'), 'colspan' => 2));
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
/**
|
||||
* Implement hook_node_view().
|
||||
*/
|
||||
function node_test_node_view(stdClass $node, $build_mode) {
|
||||
function node_test_node_view($node, $build_mode) {
|
||||
if ($build_mode == 'rss') {
|
||||
// Add RSS elements and namespaces when building the RSS feed.
|
||||
$node->rss_elements[] = array(
|
||||
|
@ -51,7 +51,7 @@ function node_test_node_grants($account, $op) {
|
|||
/**
|
||||
* Implement hook_node_access_records().
|
||||
*/
|
||||
function node_test_node_access_records(stdClass $node) {
|
||||
function node_test_node_access_records($node) {
|
||||
$grants = array();
|
||||
if ($node->type == 'article') {
|
||||
// Create grant in arbitrary article_realm for article nodes.
|
||||
|
@ -81,7 +81,7 @@ function node_test_node_access_records(stdClass $node) {
|
|||
/**
|
||||
* Implement hook_node_access_records_alter().
|
||||
*/
|
||||
function node_test_node_access_records_alter(&$grants, stdClass $node) {
|
||||
function node_test_node_access_records_alter(&$grants, $node) {
|
||||
if (!empty($grants)) {
|
||||
foreach ($grants as $key => $grant) {
|
||||
// Alter grant from test_page_realm to test_alter_realm and modify the gid.
|
||||
|
|
|
@ -180,7 +180,7 @@ function path_form_element_validate($element, &$form_state, $complete_form) {
|
|||
/**
|
||||
* Implement hook_node_insert().
|
||||
*/
|
||||
function path_node_insert(stdClass $node) {
|
||||
function path_node_insert($node) {
|
||||
if (isset($node->path)) {
|
||||
$path = $node->path;
|
||||
$path['alias'] = trim($path['alias']);
|
||||
|
@ -197,7 +197,7 @@ function path_node_insert(stdClass $node) {
|
|||
/**
|
||||
* Implement hook_node_update().
|
||||
*/
|
||||
function path_node_update(stdClass $node) {
|
||||
function path_node_update($node) {
|
||||
if (isset($node->path)) {
|
||||
$path = $node->path;
|
||||
$path['alias'] = trim($path['alias']);
|
||||
|
@ -218,7 +218,7 @@ function path_node_update(stdClass $node) {
|
|||
/**
|
||||
* Implement hook_node_delete().
|
||||
*/
|
||||
function path_node_delete(stdClass $node) {
|
||||
function path_node_delete($node) {
|
||||
// Delete all aliases associated with this node.
|
||||
path_delete(array('source' => 'node/' . $node->nid));
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ function poll_menu() {
|
|||
/**
|
||||
* Callback function to see if a node is acceptable for poll menu items.
|
||||
*/
|
||||
function _poll_menu_access(stdClass $node, $perm, $inspect_allowvotes) {
|
||||
function _poll_menu_access($node, $perm, $inspect_allowvotes) {
|
||||
return user_access($perm) && ($node->type == 'poll') && ($node->allowvotes || !$inspect_allowvotes);
|
||||
}
|
||||
|
||||
|
@ -211,7 +211,7 @@ function poll_field_extra_fields($bundle) {
|
|||
/**
|
||||
* Implement hook_form().
|
||||
*/
|
||||
function poll_form(stdClass $node, $form_state) {
|
||||
function poll_form($node, $form_state) {
|
||||
global $user;
|
||||
|
||||
$admin = user_access('administer nodes') || user_access('edit any poll content') || (user_access('edit own poll content') && $user->uid == $node->uid);
|
||||
|
@ -397,7 +397,7 @@ function poll_node_form_submit(&$form, &$form_state) {
|
|||
/**
|
||||
* Implement hook_validate().
|
||||
*/
|
||||
function poll_validate(stdClass $node, $form) {
|
||||
function poll_validate($node, $form) {
|
||||
if (isset($node->title)) {
|
||||
// Check for at least two options and validate amount of votes:
|
||||
$realchoices = 0;
|
||||
|
@ -421,7 +421,7 @@ function poll_validate(stdClass $node, $form) {
|
|||
/**
|
||||
* Implement hook_node_prepare_translation().
|
||||
*/
|
||||
function poll_node_prepare_translation(stdClass $node) {
|
||||
function poll_node_prepare_translation($node) {
|
||||
if ($node->type == 'poll') {
|
||||
$node->choice = $node->translation_source->choice;
|
||||
}
|
||||
|
@ -469,7 +469,7 @@ function poll_load($nodes) {
|
|||
/**
|
||||
* Implement hook_insert().
|
||||
*/
|
||||
function poll_insert(stdClass $node) {
|
||||
function poll_insert($node) {
|
||||
if (!user_access('administer nodes')) {
|
||||
// Make sure all votes are 0 initially
|
||||
foreach ($node->choice as $i => $choice) {
|
||||
|
@ -503,7 +503,7 @@ function poll_insert(stdClass $node) {
|
|||
/**
|
||||
* Implement hook_update().
|
||||
*/
|
||||
function poll_update(stdClass $node) {
|
||||
function poll_update($node) {
|
||||
// Update poll settings.
|
||||
db_update('poll')
|
||||
->fields(array(
|
||||
|
@ -540,7 +540,7 @@ function poll_update(stdClass $node) {
|
|||
/**
|
||||
* Implement hook_delete().
|
||||
*/
|
||||
function poll_delete(stdClass $node) {
|
||||
function poll_delete($node) {
|
||||
db_delete('poll')
|
||||
->condition('nid', $node->nid)
|
||||
->execute();
|
||||
|
@ -558,7 +558,7 @@ function poll_delete(stdClass $node) {
|
|||
* @param $node
|
||||
* The node object to load.
|
||||
*/
|
||||
function poll_block_latest_poll_view(stdClass $node) {
|
||||
function poll_block_latest_poll_view($node) {
|
||||
global $user;
|
||||
$output = '';
|
||||
|
||||
|
@ -596,7 +596,7 @@ function poll_block_latest_poll_view(stdClass $node) {
|
|||
/**
|
||||
* Implement hook_view().
|
||||
*/
|
||||
function poll_view(stdClass $node, $build_mode = 'full') {
|
||||
function poll_view($node, $build_mode = 'full') {
|
||||
global $user;
|
||||
$output = '';
|
||||
|
||||
|
@ -614,7 +614,7 @@ function poll_view(stdClass $node, $build_mode = 'full') {
|
|||
*
|
||||
* This is primarily used for RSS.
|
||||
*/
|
||||
function poll_teaser(stdClass $node) {
|
||||
function poll_teaser($node) {
|
||||
$teaser = NULL;
|
||||
if (is_array($node->choice)) {
|
||||
foreach ($node->choice as $k => $choice) {
|
||||
|
@ -633,7 +633,7 @@ function poll_teaser(stdClass $node) {
|
|||
* @see poll_vote()
|
||||
* @see phptemplate_preprocess_poll_vote()
|
||||
*/
|
||||
function poll_view_voting($form, &$form_state, stdClass $node, $block = FALSE) {
|
||||
function poll_view_voting($form, &$form_state, $node, $block = FALSE) {
|
||||
if ($node->choice) {
|
||||
$list = array();
|
||||
foreach ($node->choice as $i => $choice) {
|
||||
|
@ -724,7 +724,7 @@ function template_preprocess_poll_vote(&$variables) {
|
|||
/**
|
||||
* Generates a graphical representation of the results of a poll.
|
||||
*/
|
||||
function poll_view_results(stdClass $node, $build_mode, $block = FALSE) {
|
||||
function poll_view_results($node, $build_mode, $block = FALSE) {
|
||||
// Count the votes and find the maximum
|
||||
$total_votes = 0;
|
||||
$max_votes = 0;
|
||||
|
|
|
@ -49,7 +49,7 @@ function poll_page() {
|
|||
/**
|
||||
* Callback for the 'votes' tab for polls you can see other votes on
|
||||
*/
|
||||
function poll_votes(stdClass $node) {
|
||||
function poll_votes($node) {
|
||||
$votes_per_page = 20;
|
||||
drupal_set_title($node->title[FIELD_LANGUAGE_NONE][0]['value']);
|
||||
|
||||
|
@ -91,7 +91,7 @@ function poll_votes(stdClass $node) {
|
|||
/**
|
||||
* Callback for the 'results' tab for polls you can vote on
|
||||
*/
|
||||
function poll_results(stdClass $node) {
|
||||
function poll_results($node) {
|
||||
drupal_set_title($node->title[FIELD_LANGUAGE_NONE][0]['value']);
|
||||
$node->show_results = TRUE;
|
||||
return node_show($node);
|
||||
|
|
|
@ -714,7 +714,7 @@ function search_touch_node($nid) {
|
|||
/**
|
||||
* Implement hook_node_update_index().
|
||||
*/
|
||||
function search_node_update_index(stdClass $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 = :nid", array(':nid' => $node->nid), array('target' => 'slave'));
|
||||
$output = array();
|
||||
|
@ -729,7 +729,7 @@ function search_node_update_index(stdClass $node) {
|
|||
/**
|
||||
* Implement hook_node_update().
|
||||
*/
|
||||
function search_node_update(stdClass $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);
|
||||
|
|
|
@ -103,7 +103,7 @@ function statistics_permission() {
|
|||
/**
|
||||
* Implement hook_node_view().
|
||||
*/
|
||||
function statistics_node_view(stdClass $node, $build_mode) {
|
||||
function statistics_node_view($node, $build_mode) {
|
||||
if ($build_mode != 'rss') {
|
||||
$links = array();
|
||||
if (user_access('view post access counter')) {
|
||||
|
@ -376,7 +376,7 @@ function _statistics_format_item($title, $path) {
|
|||
/**
|
||||
* Implement hook_node_delete().
|
||||
*/
|
||||
function statistics_node_delete(stdClass $node) {
|
||||
function statistics_node_delete($node) {
|
||||
// clean up statistics table when node is deleted
|
||||
db_delete('node_counter')
|
||||
->condition('nid', $node->nid)
|
||||
|
|
|
@ -1500,7 +1500,7 @@ function taxonomy_field_update($obj_type, $object, $field, $instance, $langcode,
|
|||
/**
|
||||
* Implement hook_node_delete().
|
||||
*/
|
||||
function taxonomy_node_delete(stdClass $node) {
|
||||
function taxonomy_node_delete($node) {
|
||||
if (variable_get('taxonomy_maintain_index_table', TRUE)) {
|
||||
// Clean up the {taxonomy_index} table when nodes are deleted.
|
||||
db_delete('taxonomy_index')->condition('nid', $node->nid)->execute();
|
||||
|
|
|
@ -158,21 +158,21 @@ function _tracker_user_access($account) {
|
|||
/**
|
||||
* Implement hook_nodeapi_insert().
|
||||
*/
|
||||
function tracker_node_insert(stdClass $node, $arg = 0) {
|
||||
function tracker_node_insert($node, $arg = 0) {
|
||||
_tracker_add($node->nid, $node->uid, $node->changed);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement hook_nodeapi_update().
|
||||
*/
|
||||
function tracker_node_update(stdClass $node, $arg = 0) {
|
||||
function tracker_node_update($node, $arg = 0) {
|
||||
_tracker_add($node->nid, $node->uid, $node->changed);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement hook_nodeapi_delete().
|
||||
*/
|
||||
function tracker_node_delete(stdClass $node, $arg = 0) {
|
||||
function tracker_node_delete($node, $arg = 0) {
|
||||
_tracker_remove($node->nid, $node->uid, $node->changed);
|
||||
}
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ function translation_menu() {
|
|||
* and where the current node is not language neutral (which should span
|
||||
* all languages).
|
||||
*/
|
||||
function _translation_tab_access(stdClass $node) {
|
||||
function _translation_tab_access($node) {
|
||||
if (!empty($node->language) && translation_supported_type($node->type)) {
|
||||
return user_access('translate content');
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ function translation_form_alter(&$form, &$form_state, $form_id) {
|
|||
* Display translation links with native language names, if this node
|
||||
* is part of a translation set.
|
||||
*/
|
||||
function translation_node_view(stdClass $node, $build_mode) {
|
||||
function translation_node_view($node, $build_mode) {
|
||||
if (isset($node->tnid) && $translations = translation_node_get_translations($node->tnid)) {
|
||||
$path = 'node/' . $node->nid;
|
||||
$links = language_negotiation_get_switch_links(LANGUAGE_TYPE_CONTENT, $path);
|
||||
|
@ -188,7 +188,7 @@ function translation_node_view(stdClass $node, $build_mode) {
|
|||
/**
|
||||
* Implement hook_node_prepare().
|
||||
*/
|
||||
function translation_node_prepare(stdClass $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']) &&
|
||||
|
@ -218,7 +218,7 @@ function translation_node_prepare(stdClass $node) {
|
|||
/**
|
||||
* Implement hook_node_insert().
|
||||
*/
|
||||
function translation_node_insert(stdClass $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)) {
|
||||
|
@ -251,7 +251,7 @@ function translation_node_insert(stdClass $node) {
|
|||
/**
|
||||
* Implement hook_node_update().
|
||||
*/
|
||||
function translation_node_update(stdClass $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) {
|
||||
|
@ -280,7 +280,7 @@ function translation_node_update(stdClass $node) {
|
|||
*
|
||||
* Ensure that duplicate translations can not be created for the same source.
|
||||
*/
|
||||
function translation_node_validate(stdClass $node, $form) {
|
||||
function translation_node_validate($node, $form) {
|
||||
// Only act on translatable nodes with a tnid or translation_source.
|
||||
if (translation_supported_type($node->type) && (!empty($node->tnid) || !empty($form['#node']->translation_source->nid))) {
|
||||
$tnid = !empty($node->tnid) ? $node->tnid : $form['#node']->translation_source->nid;
|
||||
|
@ -294,7 +294,7 @@ function translation_node_validate(stdClass $node, $form) {
|
|||
/**
|
||||
* Implement hook_node_delete().
|
||||
*/
|
||||
function translation_node_delete(stdClass $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);
|
||||
|
@ -305,7 +305,7 @@ function translation_node_delete(stdClass $node) {
|
|||
* Remove a node from its translation set (if any)
|
||||
* and update the set accordingly.
|
||||
*/
|
||||
function translation_remove_from_set(stdClass $node) {
|
||||
function translation_remove_from_set($node) {
|
||||
if (isset($node->tnid)) {
|
||||
$query = db_update('node')
|
||||
->fields(array(
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
* @param $node
|
||||
* Node object.
|
||||
*/
|
||||
function translation_node_overview(stdClass $node) {
|
||||
function translation_node_overview($node) {
|
||||
if ($node->tnid) {
|
||||
// Already part of a set, grab that set.
|
||||
$tnid = $node->tnid;
|
||||
|
|
|
@ -226,7 +226,7 @@ function trigger_forms() {
|
|||
* @return
|
||||
* The object expected by the action that is about to be called.
|
||||
*/
|
||||
function _trigger_normalize_node_context($type, stdClass $node) {
|
||||
function _trigger_normalize_node_context($type, $node) {
|
||||
// Note that comment-type actions are not supported in node contexts,
|
||||
// because we wouldn't know which comment to choose.
|
||||
switch ($type) {
|
||||
|
@ -249,7 +249,7 @@ function _trigger_normalize_node_context($type, stdClass $node) {
|
|||
* @param $a4
|
||||
* Additional argument to action function.
|
||||
*/
|
||||
function _trigger_node(stdClass $node, $hook, $a3 = NULL, $a4 = NULL) {
|
||||
function _trigger_node($node, $hook, $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.
|
||||
|
@ -290,35 +290,35 @@ function _trigger_node(stdClass $node, $hook, $a3 = NULL, $a4 = NULL) {
|
|||
/**
|
||||
* Implement hook_node_view().
|
||||
*/
|
||||
function trigger_node_view(stdClass $node, $build_mode) {
|
||||
function trigger_node_view($node, $build_mode) {
|
||||
_trigger_node($node, 'node_view', $build_mode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement hook_node_update().
|
||||
*/
|
||||
function trigger_node_update(stdClass $node) {
|
||||
function trigger_node_update($node) {
|
||||
_trigger_node($node, 'node_update');
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement hook_node_presave().
|
||||
*/
|
||||
function trigger_node_presave(stdClass $node) {
|
||||
function trigger_node_presave($node) {
|
||||
_trigger_node($node, 'node_presave');
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement hook_node_insert().
|
||||
*/
|
||||
function trigger_node_insert(stdClass $node) {
|
||||
function trigger_node_insert($node) {
|
||||
_trigger_node($node, 'node_insert');
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement hook_node_delete().
|
||||
*/
|
||||
function trigger_node_delete(stdClass $node) {
|
||||
function trigger_node_delete($node) {
|
||||
_trigger_node($node, 'node_delete');
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ function upload_permission() {
|
|||
/**
|
||||
* Inject links into $node for attachments.
|
||||
*/
|
||||
function upload_node_links(stdClass $node, $build_mode) {
|
||||
function upload_node_links($node, $build_mode) {
|
||||
$links = array();
|
||||
|
||||
// Display a link with the number of attachments
|
||||
|
@ -337,7 +337,7 @@ function upload_node_load($nodes, $types) {
|
|||
/**
|
||||
* Implement hook_node_view().
|
||||
*/
|
||||
function upload_node_view(stdClass $node, $build_mode) {
|
||||
function upload_node_view($node, $build_mode) {
|
||||
if (!isset($node->files)) {
|
||||
return;
|
||||
}
|
||||
|
@ -383,7 +383,7 @@ function upload_node_view(stdClass $node, $build_mode) {
|
|||
/**
|
||||
* Implement hook_node_insert().
|
||||
*/
|
||||
function upload_node_insert(stdClass $node) {
|
||||
function upload_node_insert($node) {
|
||||
if (user_access('upload files')) {
|
||||
upload_save($node);
|
||||
}
|
||||
|
@ -392,7 +392,7 @@ function upload_node_insert(stdClass $node) {
|
|||
/**
|
||||
* Implement hook_node_update().
|
||||
*/
|
||||
function upload_node_update(stdClass $node) {
|
||||
function upload_node_update($node) {
|
||||
if (user_access('upload files')) {
|
||||
upload_save($node);
|
||||
}
|
||||
|
@ -401,7 +401,7 @@ function upload_node_update(stdClass $node) {
|
|||
/**
|
||||
* Implement hook_node_delete().
|
||||
*/
|
||||
function upload_node_delete(stdClass $node) {
|
||||
function upload_node_delete($node) {
|
||||
db_delete('upload')->condition('nid', $node->nid)->execute();
|
||||
if (!is_array($node->files)) {
|
||||
return;
|
||||
|
@ -414,7 +414,7 @@ function upload_node_delete(stdClass $node) {
|
|||
/**
|
||||
* Implement hook_node_revision_delete().
|
||||
*/
|
||||
function upload_node_revision_delete(stdClass $node) {
|
||||
function upload_node_revision_delete($node) {
|
||||
db_delete('upload')->condition('vid', $node->vid)->execute();
|
||||
if (!is_array($node->files)) {
|
||||
return;
|
||||
|
@ -427,7 +427,7 @@ function upload_node_revision_delete(stdClass $node) {
|
|||
/**
|
||||
* Implement hook_node_search_result().
|
||||
*/
|
||||
function upload_node_search_result(stdClass $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;
|
||||
}
|
||||
|
||||
|
@ -476,7 +476,7 @@ function upload_total_space_used() {
|
|||
return db_query('SELECT SUM(f.filesize) FROM {file} f INNER JOIN {upload} u ON f.fid = u.fid')->fetchField();
|
||||
}
|
||||
|
||||
function upload_save(stdClass $node) {
|
||||
function upload_save($node) {
|
||||
if (empty($node->files) || !is_array($node->files)) {
|
||||
return;
|
||||
}
|
||||
|
@ -529,7 +529,7 @@ function upload_save(stdClass $node) {
|
|||
}
|
||||
}
|
||||
|
||||
function _upload_form(stdClass $node) {
|
||||
function _upload_form($node) {
|
||||
global $user;
|
||||
|
||||
$form = array(
|
||||
|
|
|
@ -192,7 +192,7 @@ class UploadTestCase extends DrupalWebTestCase {
|
|||
* @param string $filename Name of file to upload.
|
||||
* @param boolean $assert Assert that the node was successfully updated.
|
||||
*/
|
||||
function uploadFile(stdClass $node, $filename, $assert = TRUE) {
|
||||
function uploadFile($node, $filename, $assert = TRUE) {
|
||||
$edit = array();
|
||||
$edit['files[upload]'] = $filename; //edit-upload
|
||||
$this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
|
||||
|
|
Loading…
Reference in New Issue