diff --git a/core/modules/node/content_types.inc b/core/modules/node/content_types.inc
index 2e45c9a..bc6972f 100644
--- a/core/modules/node/content_types.inc
+++ b/core/modules/node/content_types.inc
@@ -14,14 +14,22 @@ function node_overview_types() {
$types = node_type_get_types();
$names = node_type_get_names();
$field_ui = module_exists('field_ui');
- $header = array(t('Name'), array('data' => t('Operations'), 'colspan' => $field_ui ? '4' : '2'));
+ $header = array(
+ t('Name'),
+ array(
+ 'data' => t('Operations'),
+ 'colspan' => $field_ui ? '4' : '2',
+ ),
+ );
$rows = array();
foreach ($names as $key => $name) {
$type = $types[$key];
if (node_hook($type->type, 'form')) {
$type_url_str = str_replace('_', '-', $type->type);
- $row = array(theme('node_admin_overview', array('name' => $name, 'type' => $type)));
+ $row = array(
+ theme('node_admin_overview', array('name' => $name, 'type' => $type)),
+ );
// Set the edit column.
$row[] = array('data' => l(t('edit'), 'admin/structure/types/manage/' . $type_url_str));
@@ -58,7 +66,7 @@ function node_overview_types() {
/**
* Returns HTML for a node type description for the content type admin page.
*
- * @param $variables
+ * @param array $variables
* An associative array containing:
* - name: The human-readable name of the content type.
* - type: An object containing the 'type' (machine name) and 'description' of
@@ -79,7 +87,13 @@ function theme_node_admin_overview($variables) {
/**
* Form constructor for the node type editing form.
*
- * @param $type
+ * @param array $form
+ * An array representing the form.
+ *
+ * @param array $form_state
+ * An array representing the form_state.
+ *
+ * @param object $type
* (optional) An object representing the node type, when editing an existing
* node type.
*
@@ -174,7 +188,8 @@ function node_type_form($form, &$form_state, $type = NULL) {
'#collapsed' => TRUE,
'#group' => 'additional_settings',
);
- $form['workflow']['node_options'] = array('#type' => 'checkboxes',
+ $form['workflow']['node_options'] = array(
+ '#type' => 'checkboxes',
'#title' => t('Default options'),
'#default_value' => variable_get('node_options_' . $type->type, array('status', 'promote')),
'#options' => array(
@@ -268,7 +283,7 @@ function node_type_form_validate($form, &$form_state) {
$type->type = trim($form_state['values']['type']);
$type->name = trim($form_state['values']['name']);
- // Work out what the type was before the user submitted this form
+ // Work out what the type was before the user submitted this form.
$old_type = trim($form_state['values']['old_type']);
$types = node_type_get_names();
@@ -401,7 +416,7 @@ function node_node_type_update($info) {
* Resets all of the relevant fields of a module-defined node type to their
* default values.
*
- * @param $type
+ * @param object $type
* The node type to reset. The node type is passed back by reference with its
* resetted values. If there is no module-defined info for this node type,
* then nothing happens.
@@ -421,10 +436,16 @@ function node_type_reset($type) {
/**
* Page callback: Form constructor for the content type delete form.
*
- * @param $type
+ * @param array $form
+ * An array representing the form.
+ *
+ * @param array $form_state
+ * An array representing the form_state.
+ *
+ * @param object $type
* Content type object.
*
- * @return
+ * @return array
* Form array for delete confirmation form.
*
* @see node_type_delete_confirm_submit()
diff --git a/core/modules/node/node.admin.inc b/core/modules/node/node.admin.inc
index ac18da7..ba5089a 100644
--- a/core/modules/node/node.admin.inc
+++ b/core/modules/node/node.admin.inc
@@ -1,12 +1,12 @@
t('status'),
'options' => array(
@@ -89,7 +89,7 @@ function node_filters() {
'sticky-0' => t('not sticky'),
),
);
- // Include translation states if we have this module enabled
+ // Include translation states if we have this module enabled.
if (module_exists('translation')) {
$filters['status']['options'] += array(
'translate-0' => t('Up to date translation'),
@@ -124,17 +124,18 @@ function node_filters() {
/**
* Applies filters for the node administration overview based on session.
*
- * @param $query
+ * @param object $query
* A SelectQuery to which the filters should be applied.
*/
function node_build_filter_query(SelectInterface $query) {
- // Build query
+ // Build query.
$filter_data = isset($_SESSION['node_overview_filter']) ? $_SESSION['node_overview_filter'] : array();
foreach ($filter_data as $index => $filter) {
list($key, $value) = $filter;
switch ($key) {
case 'status':
- // Note: no exploitable hole as $key/$value have already been checked when submitted
+ // Note: no exploitable hole as $key/$value have already been
+ // checked when submitted.
list($key, $value) = explode('-', $value, 2);
case 'type':
case 'language':
@@ -250,9 +251,11 @@ function node_filter_form_submit($form, &$form_state) {
}
}
break;
+
case t('Undo'):
array_pop($_SESSION['node_overview_filter']);
break;
+
case t('Reset'):
$_SESSION['node_overview_filter'] = array();
break;
@@ -280,7 +283,7 @@ function node_mass_update($nodes, $updates) {
if (count($nodes) > 10) {
$batch = array(
'operations' => array(
- array('_node_mass_update_batch_process', array($nodes, $updates))
+ array('_node_mass_update_batch_process', array($nodes, $updates)),
),
'finished' => '_node_mass_update_batch_finished',
'title' => t('Processing'),
@@ -305,9 +308,9 @@ function node_mass_update($nodes, $updates) {
/**
* Updates individual nodes when fewer than 10 are queued.
*
- * @param $nid
+ * @param int $nid
* ID of node to update.
- * @param $updates
+ * @param array $updates
* Associative array of updates.
*
* @see node_mass_update()
@@ -440,7 +443,10 @@ function node_admin_nodes() {
'type' => array('data' => t('Content type'), 'field' => 'n.type'),
'author' => t('Author'),
'status' => array('data' => t('Status'), 'field' => 'n.status'),
- 'changed' => array('data' => t('Updated'), 'field' => 'n.changed', 'sort' => 'desc')
+ 'changed' => array(
+ 'data' => t('Updated'),
+ 'field' => 'n.changed',
+ 'sort' => 'desc'),
);
if ($multilingual) {
$header['language_name'] = array('data' => t('Language'), 'field' => 'n.langcode');
@@ -466,7 +472,7 @@ function node_admin_nodes() {
}
}
$nids = $query
- ->fields('n',array('nid'))
+ ->fields('n', array('nid'))
->limit(50)
->orderByHeader($header)
->execute()
@@ -597,7 +603,7 @@ function node_admin_nodes_validate($form, &$form_state) {
function node_admin_nodes_submit($form, &$form_state) {
$operations = module_invoke_all('node_operations');
$operation = $operations[$form_state['values']['operation']];
- // Filter out unchecked nodes
+ // Filter out unchecked nodes.
$nodes = array_filter($form_state['values']['nodes']);
if ($function = $operation['callback']) {
// Add in callback arguments if present.
@@ -629,8 +635,12 @@ function node_admin_nodes_submit($form, &$form_state) {
* @see node_filter_form_submit()
*/
function node_multiple_delete_confirm($form, &$form_state, $nodes) {
- $form['nodes'] = array('#prefix' => '
', '#tree' => TRUE);
- // array_filter returns only elements with TRUE values
+ $form['nodes'] = array(
+ '#prefix' => '',
+ '#tree' => TRUE,
+ );
+ // array_filter returns only elements with TRUE values.
foreach ($nodes as $nid => $value) {
$title = db_query('SELECT title FROM {node} WHERE nid = :nid', array(':nid' => $nid))->fetchField();
$form['nodes'][$nid] = array(
diff --git a/core/modules/node/node.api.php b/core/modules/node/node.api.php
index 2324b47..2d9245f 100644
--- a/core/modules/node/node.api.php
+++ b/core/modules/node/node.api.php
@@ -179,12 +179,12 @@
* sure to restore your {node_access} record after node_access_rebuild() is
* called.
*
- * @param $account
+ * @param object $account
* The user object whose grants are requested.
- * @param $op
+ * @param string $op
* The node operation to be performed, such as "view", "update", or "delete".
*
- * @return
+ * @return array
* An array whose keys are "realms" of grants, and whose values are arrays of
* the grant IDs within this realm that this user is being granted.
*
@@ -253,10 +253,10 @@ function hook_node_grants($account, $op) {
*
* Note: a deny all grant is not written to the database; denies are implicit.
*
- * @param $node
+ * @param object $node
* The node that has just been saved.
*
- * @return
+ * @return array
* An array of grants as defined above.
*
* @see _node_access_write_grants()
@@ -311,9 +311,9 @@ function hook_node_access_records($node) {
*
* A module may deny all access to a node by setting $grants to an empty array.
*
- * @param $grants
+ * @param array $grants
* The $grants array returned by hook_node_access_records().
- * @param $node
+ * @param object $node
* The node for which the grants were acquired.
*
* The preferred use of this hook is in a module that bridges multiple node
@@ -359,11 +359,11 @@ function hook_node_access_records_alter(&$grants, $node) {
* permissions assigned to a user role, or specific attributes of a user
* account.
*
- * @param $grants
+ * @param array $grants
* The $grants array returned by hook_node_grants().
- * @param $account
+ * @param object $account
* The user account requesting access to content.
- * @param $op
+ * @param string $op
* The operation being performed, 'view', 'update' or 'delete'.
*
* @see hook_node_grants()
@@ -376,7 +376,6 @@ function hook_node_grants_alter(&$grants, $account, $op) {
// content. Since some other node access modules might allow this
// permission, we expressly remove it by returning an empty $grants
// array for roles specified in our variable setting.
-
// Get our list of banned roles.
$restricted = variable_get('example_restricted_roles', array());
@@ -399,7 +398,7 @@ function hook_node_grants_alter(&$grants, $account, $op) {
* callback function receives one initial argument, which is an array of the
* checked nodes.
*
- * @return
+ * @return array
* An array of operations. Each operation is an associative array that may
* contain the following key-value pairs:
* - 'label': Required. The label for the operation, displayed in the dropdown
@@ -456,7 +455,7 @@ function hook_node_operations() {
* field_attach_delete() are called, and before the node is removed from the
* node table in the database.
*
- * @param $node
+ * @param object $node
* The node that is about to be deleted.
*
* @see hook_node_predelete()
@@ -475,7 +474,7 @@ function hook_node_predelete($node) {
* This hook is invoked from node_delete_multiple() after field_attach_delete()
* has been called and after the node has been removed from the database.
*
- * @param $node
+ * @param object $node
* The node that has been deleted.
*
* @see hook_node_predelete()
@@ -493,7 +492,7 @@ function hook_node_delete($node) {
* removed from the node_revision table, and before
* field_attach_delete_revision() is called.
*
- * @param $node
+ * @param object $node
* The node revision (node object) that is being deleted.
*
* @ingroup node_api_hooks
@@ -511,7 +510,7 @@ function hook_node_revision_delete($node) {
* node table in the database, after the type-specific hook_insert() is invoked,
* and after field_attach_insert() is called.
*
- * @param $node
+ * @param object $node
* The node that is being created.
*
* @ingroup node_api_hooks
@@ -547,9 +546,9 @@ function hook_node_insert($node) {
* module defines a content type, you can use hook_load() to respond to loading
* of just that content type.
*
- * @param $nodes
+ * @param array $nodes
* An array of the nodes being loaded, keyed by nid.
- * @param $types
+ * @param array $types
* An array containing the types of the nodes.
*
* For a detailed usage example, see nodeapi_example.module.
@@ -634,7 +633,7 @@ function hook_node_access($node, $op, $account) {
* This hook is invoked from node_object_prepare() after the type-specific
* hook_prepare() is invoked.
*
- * @param $node
+ * @param object $node
* The node that is about to be shown on the add/edit form.
*
* @ingroup node_api_hooks
@@ -651,7 +650,7 @@ function hook_node_prepare($node) {
* This hook is invoked from node_search_execute(), after node_load()
* and node_view() have been called.
*
- * @param $node
+ * @param object $node
* The node being displayed in a search result.
*
* @return array
@@ -667,7 +666,9 @@ function hook_node_prepare($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 array('comment' => format_plural($comments, '1 comment', '@count comments'));
+ return array(
+ 'comment' => format_plural($comments, '1 comment', '@count comments'),
+ );
}
/**
@@ -676,7 +677,7 @@ function hook_node_search_result($node) {
* This hook is invoked from node_save() before the node is saved to the
* database.
*
- * @param $node
+ * @param object $node
* The node that is being inserted or updated.
*
* @ingroup node_api_hooks
@@ -697,7 +698,7 @@ function hook_node_presave($node) {
* table in the database, after the type-specific hook_update() is invoked, and
* after field_attach_update() is called.
*
- * @param $node
+ * @param object $node
* The node that is being updated.
*
* @ingroup node_api_hooks
@@ -715,7 +716,7 @@ function hook_node_update($node) {
* This hook is invoked during search indexing, after node_load(), and after
* the result of node_view() is added as $node->rendered to the node object.
*
- * @param $node
+ * @param object $node
* The node being indexed.
*
* @return string
@@ -747,11 +748,11 @@ function hook_node_update_index($node) {
* hook_node_presave() instead. If it is really necessary to change
* the node at the validate stage, you can use form_set_value().
*
- * @param $node
+ * @param object $node
* The node being validated.
- * @param $form
+ * @param array $form
* The form being used to edit the node.
- * @param $form_state
+ * @param array $form_state
* The form state array.
*
* @ingroup node_api_hooks
@@ -775,11 +776,11 @@ function hook_node_validate($node, $form, &$form_state) {
* properties. See hook_field_attach_submit() for customizing field-related
* properties.
*
- * @param $node
+ * @param object $node
* The node object being updated in response to a form submission.
- * @param $form
+ * @param array $form
* The form being used to edit the node.
- * @param $form_state
+ * @param array $form_state
* The form state array.
*
* @ingroup node_api_hooks
@@ -804,11 +805,11 @@ function hook_node_submit($node, $form, &$form_state) {
* the RSS item generated for this node.
* For details on how this is used, see node_feed().
*
- * @param $node
+ * @param object $node
* The node that is being assembled for rendering.
- * @param $view_mode
+ * @param string $view_mode
* The $view_mode parameter from node_view().
- * @param $langcode
+ * @param string $langcode
* The language code used for rendering.
*
* @see forum_node_view()
@@ -837,7 +838,7 @@ function hook_node_view($node, $view_mode, $langcode) {
* callback. Alternatively, it could also implement hook_preprocess_node(). See
* drupal_render() and theme() documentation respectively for details.
*
- * @param $build
+ * @param array $build
* A renderable array representing the node content.
*
* @see node_view()
@@ -868,7 +869,7 @@ function hook_node_view_alter(&$build) {
* database table, and should be maintained by using the node_type_save() and
* node_type_delete() functions.
*
- * @return
+ * @return array
* An array of information defining the module's node types. The array
* contains a sub-array for each node type, with the the machine name of a
* content type as the key. Each sub-array has up to 10 attributes.
@@ -907,7 +908,7 @@ function hook_node_info() {
'base' => 'forum',
'description' => t('A forum topic starts a new discussion thread within a forum.'),
'title_label' => t('Subject'),
- )
+ ),
);
}
@@ -932,7 +933,7 @@ function hook_node_info() {
* and then the weighted scores from all ranking mechanisms are added, which
* brings about the same result as a weighted average.
*
- * @return
+ * @return array
* An associative array of ranking data. The keys should be strings,
* corresponding to the internal name of the ranking mechanism, such as
* 'recent', or 'comments'. The values should be arrays themselves, with the
@@ -960,11 +961,11 @@ function hook_ranking() {
return array(
'vote_average' => array(
'title' => t('Average vote'),
- // Note that we use i.sid, the search index's search item id, rather than
- // n.nid.
+ // Note that we use i.sid, the search index's search item id, rather
+ // than n.nid.
'join' => 'LEFT JOIN {vote_node_data} vote_node_data ON vote_node_data.nid = i.sid',
- // The highest possible score should be 1, and the lowest possible score,
- // always 0, should be 0.
+ // The highest possible score should be 1, and the lowest possible
+ // score, always 0, should be 0.
'score' => 'vote_node_data.average / CAST(%f AS DECIMAL)',
// Pass in the highest possible voting score as a decimal argument.
'arguments' => array(variable_get('vote_score_max', 5)),
@@ -980,7 +981,7 @@ function hook_ranking() {
* This hook is invoked from node_type_save() after the node type is added
* to the database.
*
- * @param $info
+ * @param object $info
* The node type object that is being created.
*/
function hook_node_type_insert($info) {
@@ -993,7 +994,7 @@ function hook_node_type_insert($info) {
* This hook is invoked from node_type_save() after the node type is updated
* in the database.
*
- * @param $info
+ * @param object $info
* The node type object that is being updated.
*/
function hook_node_type_update($info) {
@@ -1010,7 +1011,7 @@ function hook_node_type_update($info) {
* This hook is invoked from node_type_delete() after the node type is removed
* from the database.
*
- * @param $info
+ * @param object $info
* The node type object that is being deleted.
*/
function hook_node_type_delete($info) {
@@ -1027,7 +1028,7 @@ function hook_node_type_delete($info) {
* removed from the node table in the database, before hook_node_delete() is
* invoked, and before field_attach_delete() is called.
*
- * @param $node
+ * @param object $node
* The node that is being deleted.
*
* @ingroup node_api_hooks
@@ -1047,7 +1048,7 @@ function hook_delete($node) {
* This hook is invoked from node_object_prepare() before the general
* hook_node_prepare() is invoked.
*
- * @param $node
+ * @param object $node
* The node that is about to be shown on the add/edit form.
*
* @ingroup node_api_hooks
@@ -1083,12 +1084,12 @@ function hook_prepare($node) {
* displayed automatically by the node module. This hook just needs to
* return the node title and form editing fields specific to the node type.
*
- * @param $node
+ * @param object $node
* The node being added or edited.
- * @param $form_state
+ * @param array $form_state
* The form state array.
*
- * @return
+ * @return array
* An array containing the title and any custom form elements to be displayed
* in the node editing form.
*
@@ -1101,7 +1102,7 @@ function hook_form($node, &$form_state) {
'#type' => 'textfield',
'#title' => check_plain($type->title_label),
'#default_value' => !empty($node->title) ? $node->title : '',
- '#required' => TRUE, '#weight' => -5
+ '#required' => TRUE, '#weight' => -5,
);
$form['field1'] = array(
@@ -1135,7 +1136,7 @@ function hook_form($node, &$form_state) {
* node table in the database, before field_attach_insert() is called, and
* before hook_node_insert() is invoked.
*
- * @param $node
+ * @param object $node
* The node that is being created.
*
* @ingroup node_api_hooks
@@ -1169,7 +1170,7 @@ function hook_insert($node) {
* information for all available nodes should be loaded in a single query where
* possible.
*
- * @param $nodes
+ * @param array $nodes
* An array of the nodes being loaded, keyed by nid.
*
* For a detailed usage example, see node_example.module.
@@ -1193,7 +1194,7 @@ function hook_load($nodes) {
* node table in the database, before field_attach_update() is called, and
* before hook_node_update() is invoked.
*
- * @param $node
+ * @param object $node
* The node that is being updated.
*
* @ingroup node_api_hooks
@@ -1222,11 +1223,11 @@ function hook_update($node) {
* have no effect. The preferred method to change a node's content is to use
* hook_node_presave() instead.
*
- * @param $node
+ * @param object $node
* The node being validated.
- * @param $form
+ * @param array $form
* The form being used to edit the node.
- * @param $form_state
+ * @param array $form_state
* The form state array.
*
* @ingroup node_api_hooks
@@ -1249,12 +1250,12 @@ function hook_validate($node, $form, &$form_state) {
* so that the node type module can define a custom method for display, or
* add to the default display.
*
- * @param $node
+ * @param object $node
* The node to be displayed, as returned by node_load().
- * @param $view_mode
+ * @param string $view_mode
* View mode, e.g. 'full', 'teaser', ...
*
- * @return
+ * @return object
* The passed $node parameter should be modified as necessary and
* returned so it can be properly presented. Nodes are prepared for display
* by assembling a structured array, formatted as in the Form API, in
diff --git a/core/modules/node/node.js b/core/modules/node/node.js
index 8990164..33d4750 100644
--- a/core/modules/node/node.js
+++ b/core/modules/node/node.js
@@ -23,8 +23,8 @@ Drupal.behaviors.nodeFieldsetSummaries = {
var name = $context.find('.form-item-name input').val() || Drupal.settings.anonymous,
date = $context.find('.form-item-date input').val();
return date ?
- Drupal.t('By @name on @date', { '@name': name, '@date': date }) :
- Drupal.t('By @name', { '@name': name });
+ Drupal.t('By @name on @date', {'@name': name, '@date': date}) :
+ Drupal.t('By @name', {'@name': name});
});
$context.find('fieldset.node-form-options').drupalSetSummary(function (context) {
diff --git a/core/modules/node/node.pages.inc b/core/modules/node/node.pages.inc
index 4e94b26..e060463 100644
--- a/core/modules/node/node.pages.inc
+++ b/core/modules/node/node.pages.inc
@@ -40,7 +40,7 @@ function node_add_page() {
/**
* Returns HTML for a list of available node types for node creation.
*
- * @param $variables
+ * @param array $variables
* An associative array containing:
* - content: An array of content types.
*
@@ -69,10 +69,10 @@ function theme_node_add_list($variables) {
/**
* Page callback: Provides the node submission form.
*
- * @param $type
+ * @param string $type
* The node type for the submitted node.
*
- * @return
+ * @return array
* Returns a node submission form.
*
* @see node_menu()
@@ -81,7 +81,11 @@ function node_add($type) {
global $user;
$types = node_type_get_types();
- $node = (object) array('uid' => $user->uid, 'name' => (isset($user->name) ? $user->name : ''), 'type' => $type, 'langcode' => LANGUAGE_NOT_SPECIFIED);
+ $node = (object) array(
+ 'uid' => $user->uid,
+ 'name' => (isset($user->name) ? $user->name : ''),
+ 'type' => $type, 'langcode' => LANGUAGE_NOT_SPECIFIED,
+ );
drupal_set_title(t('Create @name', array('@name' => $types[$type]->name)), PASS_THROUGH);
$output = drupal_get_form($type . '_node_form', $node);
@@ -209,7 +213,7 @@ function node_form($form, &$form_state, $node) {
'#type' => 'fieldset',
'#title' => t('Revision information'),
'#collapsible' => TRUE,
- // Collapsed by default when "Create new revision" is unchecked
+ // Collapsed by default when "Create new revision" is unchecked.
'#collapsed' => !$node->revision,
'#group' => 'additional_settings',
'#attributes' => array(
@@ -245,7 +249,7 @@ function node_form($form, &$form_state, $node) {
'#description' => t('Briefly describe the changes you have made.'),
);
- // Node author information for administrators
+ // Node author information for administrators.
$form['author'] = array(
'#type' => 'fieldset',
'#access' => user_access('administer nodes'),
@@ -280,11 +284,16 @@ function node_form($form, &$form_state, $node) {
'#type' => 'textfield',
'#title' => t('Authored on'),
'#maxlength' => 25,
- '#description' => t('Format: %time. The date format is YYYY-MM-DD and %timezone is the time zone offset from UTC. Leave blank to use the time of form submission.', array('%time' => !empty($node->date) ? date_format(date_create($node->date), 'Y-m-d H:i:s O') : format_date($node->created, 'custom', 'Y-m-d H:i:s O'), '%timezone' => !empty($node->date) ? date_format(date_create($node->date), 'O') : format_date($node->created, 'custom', 'O'))),
+ '#description' => t('Format: %time. The date format is YYYY-MM-DD and %timezone is the time zone offset from UTC. Leave blank to use the time of form submission.',
+ array(
+ '%time' => !empty($node->date) ? date_format(date_create($node->date), 'Y-m-d H:i:s O') : format_date($node->created, 'custom', 'Y-m-d H:i:s O'),
+ '%timezone' => !empty($node->date) ? date_format(date_create($node->date), 'O') : format_date($node->created, 'custom', 'O'),
+ )
+ ),
'#default_value' => !empty($node->date) ? $node->date : '',
);
- // Node options for administrators
+ // Node options for administrators.
$form['options'] = array(
'#type' => 'fieldset',
'#access' => user_access('administer nodes'),
@@ -391,10 +400,10 @@ function node_form_build_preview($form, &$form_state) {
/**
* Generates a node preview.
*
- * @param $node
+ * @param object $node
* The node to preview.
*
- * @return
+ * @return string
* Themed node preview.
*
* @see node_form_build_preview()
@@ -411,7 +420,8 @@ function node_preview($node) {
$node->picture = $user->picture;
}
else {
- $node->uid = 0; // anonymous user
+ // Anonymous user.
+ $node->uid = 0;
}
}
elseif ($node->uid) {
@@ -439,7 +449,7 @@ function node_preview($node) {
/**
* Returns HTML for a node preview for display during node creation and editing.
*
- * @param $variables
+ * @param array $variables
* An associative array containing:
* - node: The node object which is being previewed.
*
@@ -589,7 +599,13 @@ function node_delete_confirm_submit($form, &$form_state) {
function node_revision_overview($node) {
drupal_set_title(t('Revisions for %title', array('%title' => $node->title)), PASS_THROUGH);
- $header = array(t('Revision'), array('data' => t('Operations'), 'colspan' => 2));
+ $header = array(
+ t('Revision'),
+ array(
+ 'data' => t('Operations'),
+ 'colspan' => 2,
+ ),
+ );
$revisions = node_revision_list($node);
@@ -607,13 +623,30 @@ function node_revision_overview($node) {
$operations = array();
if ($revision->current_vid > 0) {
- $row[] = array('data' => t('!date by !username', array('!date' => l(format_date($revision->timestamp, 'short'), "node/$node->nid"), '!username' => theme('username', array('account' => $revision))))
- . (($revision->log != '') ? '' . filter_xss($revision->log) . '
' : ''),
- 'class' => array('revision-current'));
- $operations[] = array('data' => drupal_placeholder(t('current revision')), 'class' => array('revision-current'), 'colspan' => 2);
+ $row[] = array(
+ 'data' => t(
+ '!date by !username',
+ array(
+ '!date' => l(format_date($revision->timestamp, 'short'),
+ "node/$node->nid"),
+ '!username' => theme('username', array('account' => $revision)),
+ )
+ )
+ . (($revision->log != '') ? '' . filter_xss($revision->log) . '
' : ''),
+ 'class' => array('revision-current'));
+ $operations[] = array(
+ 'data' => drupal_placeholder(t('current revision')),
+ 'class' => array('revision-current'), 'colspan' => 2,
+ );
}
else {
- $row[] = t('!date by !username', array('!date' => l(format_date($revision->timestamp, 'short'), "node/$node->nid/revisions/$revision->vid/view"), '!username' => theme('username', array('account' => $revision))))
+ $row[] = t('!date by !username',
+ array(
+ '!date' => l(format_date($revision->timestamp, 'short'),
+ "node/$node->nid/revisions/$revision->vid/view"),
+ '!username' => theme('username', array('account' => $revision)),
+ )
+ )
. (($revision->log != '') ? '' . filter_xss($revision->log) . '
' : '');
if ($revert_permission) {
$operations[] = l(t('revert'), "node/$node->nid/revisions/$revision->vid/revert");
@@ -629,7 +662,7 @@ function node_revision_overview($node) {
'#theme' => 'table',
'#rows' => $rows,
'#header' => $header,
- '#attached' => array (
+ '#attached' => array(
'css' => array(drupal_get_path('module', 'node') . '/node.admin.css'),
),
);
@@ -660,8 +693,22 @@ function node_revision_revert_confirm_submit($form, &$form_state) {
node_save($node_revision);
- watchdog('content', '@type: reverted %title revision %revision.', array('@type' => $node_revision->type, '%title' => $node_revision->title, '%revision' => $node_revision->vid));
- drupal_set_message(t('@type %title has been reverted back to the revision from %revision-date.', array('@type' => node_type_get_name($node_revision), '%title' => $node_revision->title, '%revision-date' => format_date($node_revision->revision_timestamp))));
+ watchdog('content',
+ '@type: reverted %title revision %revision.',
+ array(
+ '@type' => $node_revision->type,
+ '%title' => $node_revision->title,
+ '%revision' => $node_revision->vid)
+ );
+ drupal_set_message(
+ t('@type %title has been reverted back to the revision from %revision-date.',
+ array(
+ '@type' => node_type_get_name($node_revision),
+ '%title' => $node_revision->title,
+ '%revision-date' => format_date($node_revision->revision_timestamp),
+ )
+ )
+ );
$form_state['redirect'] = 'node/' . $node_revision->nid . '/revisions';
}
@@ -685,8 +732,22 @@ function node_revision_delete_confirm_submit($form, &$form_state) {
$node_revision = $form['#node_revision'];
node_revision_delete($node_revision->vid);
- 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_type_get_name($node_revision), '%title' => $node_revision->title)));
+ 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_type_get_name($node_revision),
+ '%title' => $node_revision->title)
+ )
+ );
$form_state['redirect'] = 'node/' . $node_revision->nid;
if (db_query('SELECT COUNT(vid) FROM {node_revision} WHERE nid = :nid', array(':nid' => $node_revision->nid))->fetchField() > 1) {
$form_state['redirect'] .= '/revisions';
diff --git a/core/modules/node/node.tokens.inc b/core/modules/node/node.tokens.inc
index 1b37fc8..cc06034 100644
--- a/core/modules/node/node.tokens.inc
+++ b/core/modules/node/node.tokens.inc
@@ -5,8 +5,6 @@
* Builds placeholder replacement tokens for node-related data.
*/
-
-
/**
* Implements hook_token_info().
*/