#87474 by webernet. Move the log message field from book to node module.
parent
b4faaa3cad
commit
1237159381
|
@ -232,13 +232,6 @@ function book_form(&$node) {
|
|||
);
|
||||
$form['body_filter']['format'] = filter_form($node->format);
|
||||
|
||||
$form['log'] = array(
|
||||
'#type' => 'textarea',
|
||||
'#title' => t('Log message'),
|
||||
'#weight' => 5,
|
||||
'#description' => t('An explanation of the additions or updates being made to help other authors understand your motivations.'),
|
||||
);
|
||||
|
||||
if (user_access('administer nodes')) {
|
||||
$form['weight'] = array('#type' => 'weight',
|
||||
'#title' => t('Weight'),
|
||||
|
|
|
@ -571,12 +571,18 @@ function node_save(&$node) {
|
|||
// Split off revisions data to another structure
|
||||
$revisions_table_values = array('nid' => $node->nid, 'vid' => $node->vid,
|
||||
'title' => $node->title, 'body' => $node->body,
|
||||
'teaser' => $node->teaser, 'log' => $node->log, 'timestamp' => $node->changed,
|
||||
'teaser' => $node->teaser, 'timestamp' => $node->changed,
|
||||
'uid' => $user->uid, 'format' => $node->format);
|
||||
$revisions_table_types = array('nid' => '%d', 'vid' => '%d',
|
||||
'title' => "'%s'", 'body' => "'%s'",
|
||||
'teaser' => "'%s'", 'log' => "'%s'", 'timestamp' => '%d',
|
||||
'teaser' => "'%s'", 'timestamp' => '%d',
|
||||
'uid' => '%d', 'format' => '%d');
|
||||
if (!empty($node->log)) {
|
||||
// Only store the log message if there's something to store; this prevents existing
|
||||
// log messages from being unintentionally overwritten by a blank message.
|
||||
$revisions_table_values['log'] = $node->log;
|
||||
$revisions_table_types['log'] = "'%s'";
|
||||
}
|
||||
$node_table_values = array('nid' => $node->nid, 'vid' => $node->vid,
|
||||
'title' => $node->title, 'type' => $node->type, 'uid' => $node->uid,
|
||||
'status' => $node->status, 'created' => $node->created,
|
||||
|
@ -1955,6 +1961,18 @@ function node_form($node, $form_values = NULL) {
|
|||
}
|
||||
$form['#node'] = $node;
|
||||
|
||||
// Add a log field if the "Create new revisions" option is checked, or if the
|
||||
// current user has the ability to check that option.
|
||||
if ($node->revision || user_access('administer nodes')) {
|
||||
$form['log'] = array(
|
||||
'#type' => 'textarea',
|
||||
'#title' => t('Log message'),
|
||||
'#rows' => 2,
|
||||
'#weight' => 20,
|
||||
'#description' => t('An explanation of the additions or updates being made to help other authors understand your motivations.'),
|
||||
);
|
||||
}
|
||||
|
||||
// Node author information for administrators
|
||||
$form['author'] = array(
|
||||
'#type' => 'fieldset',
|
||||
|
|
Loading…
Reference in New Issue