Commit 51c004ab authored by catch's avatar catch

Issue #1361234 by duellj, loganfsmyth, aspilicious, cosmicdreams, fago,...

Issue #1361234 by duellj, loganfsmyth, aspilicious, cosmicdreams, fago, amateescu, sun: Added Make the node entity a classed object.
parent 4daf1c63
......@@ -5,6 +5,8 @@
* Admin page callbacks for the book module.
*/
use Drupal\node\Node;
/**
* Page callback: Returns an administrative overview of all books.
*
......@@ -66,7 +68,7 @@ function book_admin_settings_validate($form, &$form_state) {
/**
* Form constructor for administering a single book's hierarchy.
*
* @param $node
* @param Drupal\node\Node $node
* The node of the top-level page in the book.
*
* @see book_menu()
......@@ -74,7 +76,7 @@ function book_admin_settings_validate($form, &$form_state) {
* @see book_admin_edit_submit()
* @ingroup forms
*/
function book_admin_edit($form, $form_state, $node) {
function book_admin_edit($form, $form_state, Node $node) {
drupal_set_title($node->title);
$form['#node'] = $node;
_book_admin_table($node, $form);
......@@ -135,7 +137,7 @@ function book_admin_edit_submit($form, &$form_state) {
$node->revision = 1;
$node->log = t('Title changed from %original to %current.', array('%original' => $node->title, '%current' => $values['title']));
node_save($node);
$node->save();
watchdog('content', 'book: updated %title.', array('%title' => $node->title), WATCHDOG_NOTICE, l(t('view'), 'node/' . $node->nid));
}
}
......@@ -147,14 +149,14 @@ function book_admin_edit_submit($form, &$form_state) {
/**
* Builds the table portion of the form for the book administration page.
*
* @param $node
* @param Drupal\node\Node $node
* The node of the top-level page in the book.
* @param $form
* The form that is being modified.
*
* @see book_admin_edit()
*/
function _book_admin_table($node, &$form) {
function _book_admin_table(Node $node, &$form) {
$form['table'] = array(
'#theme' => 'book_admin_table',
'#tree' => TRUE,
......
......@@ -5,6 +5,8 @@
* Allows users to create and organize related content in an outline.
*/
use Drupal\node\Node;
/**
* Implements hook_help().
*/
......@@ -86,12 +88,12 @@ function book_permission() {
/**
* Adds relevant book links to the node's links.
*
* @param $node
* @param Drupal\node\Node $node
* The book page node to add links to.
* @param $view_mode
* The view mode of the node.
*/
function book_node_view_link($node, $view_mode) {
function book_node_view_link(Node $node, $view_mode) {
$links = array();
if (isset($node->book['depth'])) {
......@@ -201,24 +203,24 @@ function book_menu() {
* - admin/content/book/%node
* - node/%node/outline
*
* @param $node
* @param Drupal\node\Node $node
* The node whose outline tab is to be viewed.
*
* @see book_menu()
*/
function _book_outline_access($node) {
function _book_outline_access(Node $node) {
return user_access('administer book outlines') && node_access('view', $node);
}
/**
* Access callback: Determines if the user can remove nodes from the outline.
*
* @param $node
* @param Drupal\node\Node $node
* The node to remove from the outline.
*
* @see book_menu()
*/
function _book_outline_remove_access($node) {
function _book_outline_remove_access(Node $node) {
return _book_node_is_removable($node) && _book_outline_access($node);
}
......@@ -520,10 +522,10 @@ function _book_parent_select($book_link) {
/**
* Builds the common elements of the book form for the node and outline forms.
*
* @param $node
* @param Drupal\node\Node $node
* The node whose form is being viewed.
*/
function _book_add_form_elements(&$form, &$form_state, $node) {
function _book_add_form_elements(&$form, &$form_state, Node $node) {
// If the form is being processed during the Ajax callback of our book bid
// dropdown, then $form_state will hold the value that was selected.
if (isset($form_state['values']['book'])) {
......@@ -625,13 +627,13 @@ function book_form_update($form, $form_state) {
* outline through node addition, node editing, node deletion, or the outline
* tab.
*
* @param $node
* @param Drupal\node\Node $node
* The node that is being saved, added, deleted, or moved.
*
* @return
* TRUE if the menu link was saved; FALSE otherwise.
*/
function _book_update_outline($node) {
function _book_update_outline(Node $node) {
if (empty($node->book['bid'])) {
return FALSE;
}
......@@ -889,7 +891,7 @@ function book_node_load($nodes, $types) {
/**
* Implements hook_node_view().
*/
function book_node_view($node, $view_mode) {
function book_node_view(Node $node, $view_mode) {
if ($view_mode == 'full') {
if (!empty($node->book['bid']) && empty($node->in_preview)) {
$node->content['book_navigation'] = array(
......@@ -921,14 +923,10 @@ function book_page_alter(&$page) {
/**
* Implements hook_node_presave().
*/
function book_node_presave($node) {
function book_node_presave(Node $node) {
// Always save a revision for non-administrators.
if (!empty($node->book['bid']) && !user_access('administer nodes')) {
$node->revision = 1;
// The database schema requires a log message for every revision.
if (!isset($node->log)) {
$node->log = '';
}
}
// Make sure a new node gets a new menu link.
if (empty($node->nid)) {
......@@ -939,7 +937,7 @@ function book_node_presave($node) {
/**
* Implements hook_node_insert().
*/
function book_node_insert($node) {
function book_node_insert(Node $node) {
if (!empty($node->book['bid'])) {
if ($node->book['bid'] == 'new') {
// New nodes that are their own book.
......@@ -954,7 +952,7 @@ function book_node_insert($node) {
/**
* Implements hook_node_update().
*/
function book_node_update($node) {
function book_node_update(Node $node) {
if (!empty($node->book['bid'])) {
if ($node->book['bid'] == 'new') {
// New nodes that are their own book.
......@@ -969,7 +967,7 @@ function book_node_update($node) {
/**
* Implements hook_node_predelete().
*/
function book_node_predelete($node) {
function book_node_predelete(Node $node) {
if (!empty($node->book['bid'])) {
if ($node->nid == $node->book['bid']) {
// Handle deletion of a top-level post.
......@@ -993,7 +991,7 @@ function book_node_predelete($node) {
/**
* Implements hook_node_prepare().
*/
function book_node_prepare($node) {
function book_node_prepare(Node $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();
......@@ -1291,7 +1289,7 @@ function book_export_traverse($tree, $visit_func) {
/**
* Generates printer-friendly HTML for a node.
*
* @param $node
* @param Drupal\node\Node $node
* The node that will be output.
* @param $children
* All the rendered child nodes within the current node.
......@@ -1301,7 +1299,7 @@ function book_export_traverse($tree, $visit_func) {
*
* @see book_export_traverse()
*/
function book_node_export($node, $children = '') {
function book_node_export(Node $node, $children = '') {
$build = node_view($node, 'print');
unset($build['#theme']);
// @todo Rendering should happen in the template using render().
......
......@@ -5,6 +5,8 @@
* User page callbacks for the book module.
*/
use Drupal\node\Node;
/**
* Page callback: Prints a listing of all books.
*
......@@ -93,12 +95,12 @@ function book_export_html($nid) {
/**
* Page callback: Shows the outline form for a single node.
*
* @param $node
* @param Drupal\node\Node $node
* The book node for which to show the outline.
*
* @see book_menu()
*/
function book_outline($node) {
function book_outline(Node $node) {
drupal_set_title($node->title);
return drupal_get_form('book_outline_form', $node);
}
......@@ -108,14 +110,14 @@ function book_outline($node) {
*
* Allows handling of all book outline operations via the outline tab.
*
* @param $node
* @param Drupal\node\Node $node
* The book node for which to show the outline.
*
* @see book_outline_form_submit()
* @see book_remove_button_submit()
* @ingroup forms
*/
function book_outline_form($form, &$form_state, $node) {
function book_outline_form($form, &$form_state, Node $node) {
if (!isset($node->book)) {
// The node is not part of any book yet - set default options.
$node->book = _book_link_defaults($node->nid);
......@@ -197,14 +199,14 @@ function book_outline_form_submit($form, &$form_state) {
/**
* Form constructor to confirm removal of a node from a book.
*
* @param $node
* @param Drupal\node\Node $node
* The node to delete.
*
* @see book_remove_form_submit()
* @see book_menu()
* @ingroup forms
*/
function book_remove_form($form, &$form_state, $node) {
function book_remove_form($form, &$form_state, Node $node) {
$form['#node'] = $node;
$title = array('%title' => $node->title);
......
......@@ -5,6 +5,8 @@
* Tests for book.module.
*/
use Drupal\node\Node;
class BookTestCase extends DrupalWebTestCase {
protected $book;
// $book_author is a user with permission to create and edit books.
......@@ -108,7 +110,7 @@ class BookTestCase extends DrupalWebTestCase {
/**
* Check the outline of sub-pages; previous, up, and next; and printer friendly version.
*
* @param $node
* @param Node $node
* Node to check.
* @param $nodes
* Nodes that should be in outline.
......@@ -121,7 +123,7 @@ class BookTestCase extends DrupalWebTestCase {
* @param $breadcrumb
* The nodes that should be displayed in the breadcrumb.
*/
function checkBookNode($node, $nodes, $previous = FALSE, $up = FALSE, $next = FALSE, array $breadcrumb) {
function checkBookNode(Node $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;
......
......@@ -20,7 +20,7 @@
* the template.
*
* The following variables are provided for contextual information.
* - $node: Node object the comments are attached to.
* - $node: Node entity the comments are attached to.
* The constants below the variables show the possible values and should be
* used for comparison.
* - $display_mode
......
......@@ -9,6 +9,8 @@
* book page, etc.
*/
use Drupal\node\Node;
/**
* Comment is awaiting approval.
*/
......@@ -545,13 +547,13 @@ function comment_get_recent($number = 10) {
* Number of comments.
* @param $new_replies
* Number of new replies.
* @param $node
* @param Drupal\node\Node $node
* The first new comment node.
*
* @return
* "page=X" if the page number is greater than zero; empty string otherwise.
*/
function comment_new_page_count($num_comments, $new_replies, $node) {
function comment_new_page_count($num_comments, $new_replies, Node $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;
......@@ -629,7 +631,7 @@ function theme_comment_block() {
/**
* Implements hook_node_view().
*/
function comment_node_view($node, $view_mode) {
function comment_node_view(Node $node, $view_mode) {
$links = array();
if ($node->comment != COMMENT_NODE_HIDDEN) {
......@@ -737,14 +739,14 @@ function comment_node_view($node, $view_mode) {
/**
* Builds the comment-related elements for node detail pages.
*
* @param $node
* The node object for which to build the comment-related elements.
* @param Drupal\node\Node $node
* The node entity for which to build the comment-related elements.
*
* @return
* A renderable array representing the comment-related page elements for the
* node.
*/
function comment_node_page_additions($node) {
function comment_node_page_additions(Node $node) {
$additions = array();
// Only attempt to render comments if the node has visible comments.
......@@ -783,7 +785,7 @@ function comment_node_page_additions($node) {
/**
* Retrieves comments for a thread.
*
* @param $node
* @param Drupal\node\Node $node
* The node whose comment(s) needs rendering.
* @param $mode
* The comment display mode; COMMENT_MODE_FLAT or COMMENT_MODE_THREADED.
......@@ -847,7 +849,7 @@ function comment_node_page_additions($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($node, $mode, $comments_per_page) {
function comment_get_thread(Node $node, $mode, $comments_per_page) {
$query = db_select('comment', 'c')->extend('PagerDefault');
$query->addField('c', 'cid');
$query
......@@ -936,7 +938,7 @@ function comment_prepare_thread(&$comments) {
*
* @param Comment $comment
* The comment object.
* @param $node
* @param Drupal\node\Node $node
* The node the comment is attached to.
* @param $view_mode
* View mode, e.g. 'full', 'teaser'...
......@@ -947,7 +949,7 @@ function comment_prepare_thread(&$comments) {
* @return
* An array as expected by drupal_render().
*/
function comment_view(Comment $comment, $node, $view_mode = 'full', $langcode = NULL) {
function comment_view(Comment $comment, Node $node, $view_mode = 'full', $langcode = NULL) {
if (!isset($langcode)) {
$langcode = $GLOBALS['language_content']->langcode;
}
......@@ -1006,7 +1008,7 @@ function comment_view(Comment $comment, $node, $view_mode = 'full', $langcode =
*
* @param Comment $comment
* A comment object.
* @param $node
* @param Drupal\node\Node $node
* The node the comment is attached to.
* @param $view_mode
* View mode, e.g. 'full', 'teaser'...
......@@ -1014,7 +1016,7 @@ function comment_view(Comment $comment, $node, $view_mode = 'full', $langcode =
* (optional) A language code to use for rendering. Defaults to the global
* content language of the current request.
*/
function comment_build_content(Comment $comment, $node, $view_mode = 'full', $langcode = NULL) {
function comment_build_content(Comment $comment, Node $node, $view_mode = 'full', $langcode = NULL) {
if (!isset($langcode)) {
$langcode = $GLOBALS['language_content']->langcode;
}
......@@ -1050,13 +1052,13 @@ function comment_build_content(Comment $comment, $node, $view_mode = 'full', $la
*
* @param Comment $comment
* The comment object.
* @param $node
* @param Drupal\node\Node $node
* The node the comment is attached to.
*
* @return
* A structured array of links.
*/
function comment_links(Comment $comment, $node) {
function comment_links(Comment $comment, Node $node) {
$links = array();
if ($node->comment == COMMENT_NODE_OPEN) {
if (user_access('administer comments') && user_access('post comments')) {
......@@ -1111,7 +1113,7 @@ function comment_links(Comment $comment, $node) {
*
* @param $comments
* An array of comments as returned by comment_load_multiple().
* @param $node
* @param Drupal\node\Node $node
* The node the comments are attached to.
* @param $view_mode
* View mode, e.g. 'full', 'teaser'...
......@@ -1126,7 +1128,7 @@ function comment_links(Comment $comment, $node) {
*
* @see drupal_render()
*/
function comment_view_multiple($comments, $node, $view_mode = 'full', $weight = 0, $langcode = NULL) {
function comment_view_multiple($comments, Node $node, $view_mode = 'full', $weight = 0, $langcode = NULL) {
field_attach_prepare_view('comment', $comments, $view_mode, $langcode);
entity_prepare_view('comment', $comments, $langcode);
......@@ -1308,7 +1310,7 @@ function comment_node_load($nodes, $types) {
/**
* Implements hook_node_prepare().
*/
function comment_node_prepare($node) {
function comment_node_prepare(Node $node) {
if (!isset($node->comment)) {
$node->comment = variable_get("comment_$node->type", COMMENT_NODE_OPEN);
}
......@@ -1317,7 +1319,7 @@ function comment_node_prepare($node) {
/**
* Implements hook_node_insert().
*/
function comment_node_insert($node) {
function comment_node_insert(Node $node) {
// Allow bulk updates and inserts to temporarily disable the
// maintenance of the {node_comment_statistics} table.
if (variable_get('comment_maintain_node_statistics', TRUE)) {
......@@ -1337,7 +1339,7 @@ function comment_node_insert($node) {
/**
* Implements hook_node_predelete().
*/
function comment_node_predelete($node) {
function comment_node_predelete(Node $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')
......@@ -1348,7 +1350,7 @@ function comment_node_predelete($node) {
/**
* Implements hook_node_update_index().
*/
function comment_node_update_index($node) {
function comment_node_update_index(Node $node) {
$index_comments = &drupal_static(__FUNCTION__);
if ($index_comments === NULL) {
......@@ -1397,7 +1399,7 @@ function comment_update_index() {
* Formats a comment count string and returns it, for display with search
* results.
*/
function comment_node_search_result($node) {
function comment_node_search_result(Node $node) {
// Do not make a string if comments are hidden.
if (user_access('access comments') && $node->comment != COMMENT_NODE_HIDDEN) {
$comments = db_query('SELECT comment_count FROM {node_comment_statistics} WHERE nid = :nid', array('nid' => $node->nid))->fetchField();
......
......@@ -5,6 +5,8 @@
* User page callbacks for the Comment module.
*/
use Drupal\node\Node;
/**
* Form constructor for the comment reply form.
*
......@@ -17,7 +19,7 @@
* The node or comment that is being replied to must appear above the comment
* form to provide the user context while authoring the comment.
*
* @param $node
* @param Drupal\node\Node $node
* Every comment belongs to a node. This is that node.
* @param $pid
* (optional) Some comments are replies to other comments. In those cases,
......@@ -26,7 +28,7 @@
* @return
* The rendered parent node or comment plus the new comment form.
*/
function comment_reply($node, $pid = NULL) {
function comment_reply(Node $node, $pid = NULL) {
// Set the breadcrumb trail.
drupal_set_breadcrumb(array(l(t('Home'), NULL), l($node->title, 'node/' . $node->nid)));
$op = isset($_POST['op']) ? $_POST['op'] : '';
......
......@@ -23,8 +23,8 @@ class CommentHelperCase extends DrupalWebTestCase {
/**
* Posts a comment.
*
* @param $node
* Node to post comment on.
* @param Node|NULL $node
* Node to post comment on or NULL to post to the previusly loaded page.
* @param $comment
* Comment body.
* @param $subject
......
......@@ -46,7 +46,7 @@
*
* These two variables are provided for context:
* - $comment: Full comment object.
* - $node: Node object the comments are attached to.
* - $node: Node entity the comments are attached to.
*
* Other variables:
* - $classes_array: Array of html class attribute values. It is flattened
......
......@@ -414,7 +414,7 @@ public function delete() {
*/
public function createDuplicate() {
$duplicate = clone $this;
$duplicate->{$this->idKey} = NULL;
$duplicate->id = NULL;
return $duplicate;
}
......
......@@ -62,7 +62,7 @@ class EntityCrudHookTestCase extends DrupalWebTestCase {
* Tests hook invocations for CRUD operations on comments.
*/
public function testCommentHooks() {
$node = (object) array(
$node = entity_create('node', array(
'uid' => 1,
'type' => 'article',
'title' => 'Test node',
......@@ -70,11 +70,11 @@ class EntityCrudHookTestCase extends DrupalWebTestCase {
'comment' => 2,
'promote' => 0,
'sticky' => 0,
'language' => LANGUAGE_NOT_SPECIFIED,
'langcode' => LANGUAGE_NOT_SPECIFIED,
'created' => REQUEST_TIME,
'changed' => REQUEST_TIME,
);
node_save($node);
));
$node->save();
$nid = $node->nid;
$comment = entity_create('comment', array(
......@@ -86,7 +86,7 @@ class EntityCrudHookTestCase extends DrupalWebTestCase {
'created' => REQUEST_TIME,
'changed' => REQUEST_TIME,
'status' => 1,
'language' => LANGUAGE_NOT_SPECIFIED,
'langcode' => LANGUAGE_NOT_SPECIFIED,
));
$_SESSION['entity_crud_hook_test'] = array();
......@@ -189,7 +189,7 @@ class EntityCrudHookTestCase extends DrupalWebTestCase {
* Tests hook invocations for CRUD operations on nodes.
*/
public function testNodeHooks() {
$node = (object) array(
$node = entity_create('node', array(
'uid' => 1,
'type' => 'article',
'title' => 'Test node',
......@@ -197,12 +197,12 @@ class EntityCrudHookTestCase extends DrupalWebTestCase {
'comment' => 2,
'promote' => 0,
'sticky' => 0,
'language' => LANGUAGE_NOT_SPECIFIED,
'langcode' => LANGUAGE_NOT_SPECIFIED,
'created' => REQUEST_TIME,
'changed' => REQUEST_TIME,
);
));
$_SESSION['entity_crud_hook_test'] = array();
node_save($node);
$node->save();
$this->assertHookMessageOrder(array(
'entity_crud_hook_test_node_presave called',
......@@ -221,7 +221,7 @@ class EntityCrudHookTestCase extends DrupalWebTestCase {
$_SESSION['entity_crud_hook_test'] = array();
$node->title = 'New title';
node_save($node);
$node->save();
$this->assertHookMessageOrder(array(
'entity_crud_hook_test_node_presave called',
......
......@@ -5,6 +5,8 @@
* Tests for field_ui.module.
*/
use Drupal\node\Node;
/**
* Provides common functionality for the Field UI test classes.
*/
......@@ -615,7 +617,7 @@ class FieldUIManageDisplayTestCase extends FieldUITestCase {
/**
* Asserts that a string is found in the rendered node in a view mode.
*
* @param $node
* @param Node $node
* The node.
* @param $view_mode
* The view mode in which the node should be displayed.
......@@ -627,14 +629,14 @@ class FieldUIManageDisplayTestCase extends FieldUITestCase {
* @return
* TRUE on pass, FALSE on fail.
*/
function assertNodeViewText($node, $view_mode, $text, $message) {
function assertNodeViewText(Node $node, $view_mode, $text, $message) {
return $this->assertNodeViewTextHelper($node, $view_mode, $text, $message, FALSE);
}
/**
* Asserts that a string is not found in the rendered node in a view mode.
*
* @param $node
* @param Node $node
* The node.
* @param $view_mode
* The view mode in which the node should be displayed.
......@@ -645,7 +647,7 @@ class FieldUIManageDisplayTestCase extends FieldUITestCase {
* @return
* TRUE on pass, FALSE on fail.
*/
function assertNodeViewNoText($node, $view_mode, $text, $message) {
function assertNodeViewNoText(Node $node, $view_mode, $text, $message) {
return $this->assertNodeViewTextHelper($node, $view_mode, $text, $message, TRUE);
}
......@@ -655,7 +657,7 @@ class FieldUIManageDisplayTestCase extends FieldUITestCase {
* This helper function is used by assertNodeViewText() and
* assertNodeViewNoText().
*
* @param $node
* @param Node $node
* The node.
* @param $view_mode
* The view mode in which the node should be displayed.
......@@ -669,7 +671,7 @@ class FieldUIManageDisplayTestCase extends FieldUITestCase {
* @return
* TRUE on pass, FALSE on fail.
*/
function assertNodeViewTextHelper($node, $view_mode, $text, $message, $not_exists) {
function assertNodeViewTextHelper(Node $node, $view_mode, $text, $message, $not_exists) {
// Make sure caches on the tester side are refreshed after changes
// submitted on the tested side.
field_info_cache_clear();
......
......@@ -5,6 +5,8 @@
* Provides discussion forums.
*/
use Drupal\node\Node;
/**
* Implements hook_help().
*/
......@@ -244,13 +246,13 @@ function forum_uri($forum) {
/**
* Check whether a content type can be used in a forum.
*
* @param $node
* A node object.
* @param Drupal\node\Node $node
* A node entity.
*
* @return
* Boolean indicating if the node can be assigned to a forum.
*/
function _forum_node_check_node_type($node) {
function _forum_node_check_node_type(Node $node) {
// Fetch information about the forum field.
$field = field_info_instance('node', 'taxonomy_forums', $node->type);
......@@ -260,7 +262,7 @@ function _forum_node_check_node_type($node) {
/**
* Implements hook_node_view().
*/
function forum_node_view($node, $view_mode) {
function forum_node_view(Node $node, $view_mode) {
$vid = variable_get('forum_nav_vocabulary', 0);
$vocabulary = taxonomy_vocabulary_load($vid);
if (_forum_node_check_node_type($node)) {
......@@ -285,7 +287,7 @@ function forum_node_view($node, $view_mode) {
*
* Check in particular that only a "leaf" term in the associated taxonomy.
*/
function forum_node_validate($node, $form) {
function forum_node_validate(Node $node, $form) {
if (_forum_node_check_node_type($node)) {
$langcode = $form['taxonomy_forums']['#language'];
// vocabulary is selected, not a "container" term.
......@@ -321,7 +323,7 @@ function forum_node_validate($node, $form) {
*
* Assign forum taxonomy when adding a topic from within a forum.
*/
function forum_node_presave($node) {
function forum_node_presave(Node $node) {
if (_forum_node_check_node_type($node)) {
// Make sure all fields are set properly:
$node->icon = !empty($node->icon) ? $node->icon : '';
......@@ -341,7 +343,7 @@ function forum_node_presave($node) {
/**
* Implements hook_node_update().
*/
function forum_node_update($node) {
function forum_node_update(Node $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)) {
......@@ -389,7 +391,7 @@ function forum_node_update($node) {
/**
* Implements hook_node_insert().
*/
function forum_node_insert($node) {
function forum_node_insert(Node $node) {
if (_forum_node_check_node_type($node)) {
if (!empty($node->forum_tid)) {
$nid = db_insert('forum')
......@@ -406,7 +408,7 @@ function forum_node_insert($node) {
/**
* Implements hook_node_predelete().
*/
function forum_node_predelete($node) {