summaryrefslogtreecommitdiff
path: root/modules/book
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2010-01-09 21:54:01 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2010-01-09 21:54:01 +0000
commit147bb1389a18eca73015390cc46a5fe03abfcb88 (patch)
treec5798ac604e5fd2ded01f15db2f0e422b4077abb /modules/book
parent364238c585cb3c2f64b99a385c577f174cdf1f39 (diff)
downloadbrdo-147bb1389a18eca73015390cc46a5fe03abfcb88.tar.gz
brdo-147bb1389a18eca73015390cc46a5fe03abfcb88.tar.bz2
#571654 follow-up by chx, peximo, plach, sun, et al:
Roll-back of node titles as fields. The Entity Translation module in contrib can add this back, but for everyone else it creates a *huge* WTF. Apologies for how late this is coming, but better now than post-alpha. :\
Diffstat (limited to 'modules/book')
-rw-r--r--modules/book/book.admin.inc10
-rw-r--r--modules/book/book.module8
-rw-r--r--modules/book/book.pages.inc6
-rw-r--r--modules/book/book.test12
4 files changed, 18 insertions, 18 deletions
diff --git a/modules/book/book.admin.inc b/modules/book/book.admin.inc
index fe0a30d6d..618cf840e 100644
--- a/modules/book/book.admin.inc
+++ b/modules/book/book.admin.inc
@@ -72,7 +72,7 @@ function book_admin_settings_validate($form, &$form_state) {
* @ingroup forms.
*/
function book_admin_edit($form, $form_state, $node) {
- drupal_set_title($node->title[LANGUAGE_NONE][0]['value']);
+ drupal_set_title($node->title);
$form['#node'] = $node;
_book_admin_table($node, $form);
$form['save'] = array(
@@ -126,18 +126,18 @@ function book_admin_edit_submit($form, &$form_state) {
if ($row['title']['#default_value'] != $values['title']) {
$node = node_load($values['nid'], FALSE);
$langcode = LANGUAGE_NONE;
- $node->title = array($langcode => array(array('value' => $values['title'])));
+ $node->title = $values['title'];
$node->book['link_title'] = $values['title'];
$node->revision = 1;
- $node->log = t('Title changed from %original to %current.', array('%original' => $node->title[$langcode][0]['value'], '%current' => $values['title']));
+ $node->log = t('Title changed from %original to %current.', array('%original' => $node->title, '%current' => $values['title']));
node_save($node);
- watchdog('content', 'book: updated %title.', array('%title' => $node->title[$langcode][0]['value']), WATCHDOG_NOTICE, l(t('view'), 'node/' . $node->nid));
+ watchdog('content', 'book: updated %title.', array('%title' => $node->title), WATCHDOG_NOTICE, l(t('view'), 'node/' . $node->nid));
}
}
}
- drupal_set_message(t('Updated book %title.', array('%title' => $form['#node']->title[$langcode][0]['value'])));
+ drupal_set_message(t('Updated book %title.', array('%title' => $form['#node']->title)));
}
/**
diff --git a/modules/book/book.module b/modules/book/book.module
index f1a2faf67..0a9ce59a0 100644
--- a/modules/book/book.module
+++ b/modules/book/book.module
@@ -511,7 +511,7 @@ function _book_add_form_elements(&$form, &$form_state, $node) {
if (isset($node->nid) && ($nid == $node->book['original_bid']) && ($node->book['parent_depth_limit'] == 0)) {
// This is the top level node in a maximum depth book and thus cannot be moved.
- $options[$node->nid] = $node->title[LANGUAGE_NONE][0]['value'];
+ $options[$node->nid] = $node->title;
}
else {
foreach (book_get_books() as $book) {
@@ -560,7 +560,7 @@ function _book_update_outline($node) {
$new = empty($node->book['mlid']);
$node->book['link_path'] = 'node/' . $node->nid;
- $node->book['link_title'] = $node->title[LANGUAGE_NONE][0]['value'];
+ $node->book['link_title'] = $node->title;
$node->book['parent_mismatch'] = FALSE; // The normal case.
if ($node->book['bid'] == $node->nid) {
@@ -916,7 +916,7 @@ function book_form_node_delete_confirm_alter(&$form, $form_state) {
if (isset($node->book) && $node->book['has_children']) {
$form['book_warning'] = array(
- '#markup' => '<p>' . t('%title is part of a book outline, and has associated child pages. If you proceed with deletion, the child pages will be relocated automatically.', array('%title' => $node->title[LANGUAGE_NONE][0]['value'])) . '</p>',
+ '#markup' => '<p>' . t('%title is part of a book outline, and has associated child pages. If you proceed with deletion, the child pages will be relocated automatically.', array('%title' => $node->title)) . '</p>',
'#weight' => -10,
);
}
@@ -1139,7 +1139,7 @@ function book_node_export($node, $children = '') {
*/
function template_preprocess_book_node_export_html(&$variables) {
$variables['depth'] = $variables['node']->book['depth'];
- $variables['title'] = check_plain($variables['node']->title[LANGUAGE_NONE][0]['value']);
+ $variables['title'] = check_plain($variables['node']->title);
$variables['content'] = $variables['node']->rendered;
}
diff --git a/modules/book/book.pages.inc b/modules/book/book.pages.inc
index 4fab15465..832e1e3c5 100644
--- a/modules/book/book.pages.inc
+++ b/modules/book/book.pages.inc
@@ -79,7 +79,7 @@ function book_export_html($nid) {
$contents = book_export_traverse($tree, 'book_node_export');
}
- return theme('book_export_html', array('title' => $node->title[LANGUAGE_NONE][0]['value'], 'contents' => $contents, 'depth' => $node->book['depth']));
+ return theme('book_export_html', array('title' => $node->title, 'contents' => $contents, 'depth' => $node->book['depth']));
}
else {
drupal_access_denied();
@@ -90,7 +90,7 @@ function book_export_html($nid) {
* Menu callback; show the outline form for a single node.
*/
function book_outline($node) {
- drupal_set_title($node->title[LANGUAGE_NONE][0]['value']);
+ drupal_set_title($node->title);
return drupal_get_form('book_outline_form', $node);
}
@@ -188,7 +188,7 @@ function book_outline_form_submit($form, &$form_state) {
*/
function book_remove_form($form, &$form_state, $node) {
$form['#node'] = $node;
- $title = array('%title' => $node->title[LANGUAGE_NONE][0]['value']);
+ $title = array('%title' => $node->title);
if ($node->book['has_children']) {
$description = t('%title has associated child pages, which will be relocated automatically to maintain their connection to the book. To recreate the hierarchy (as it was before removing this page), %title may be added again using the Outline tab, and each of its former child pages will need to be relocated manually.', $title);
diff --git a/modules/book/book.test b/modules/book/book.test
index c051e73fb..d68a17ab3 100644
--- a/modules/book/book.test
+++ b/modules/book/book.test
@@ -110,7 +110,7 @@ class BookTestCase extends DrupalWebTestCase {
// Check previous, up, and next links.
if ($previous) {
- $this->assertRaw(l('‹ ' . $previous->title[LANGUAGE_NONE][0]['value'], 'node/' . $previous->nid, array('attributes' => array('class' => array('page-previous'), 'title' => t('Go to previous page')))), t('Previous page link found.'));
+ $this->assertRaw(l('‹ ' . $previous->title, 'node/' . $previous->nid, array('attributes' => array('class' => array('page-previous'), 'title' => t('Go to previous page')))), t('Previous page link found.'));
}
if ($up) {
@@ -118,7 +118,7 @@ class BookTestCase extends DrupalWebTestCase {
}
if ($next) {
- $this->assertRaw(l($next->title[LANGUAGE_NONE][0]['value'] . ' ›', 'node/' . $next->nid, array('attributes' => array('class' => array('page-next'), 'title' => t('Go to next page')))), t('Next page link found.'));
+ $this->assertRaw(l($next->title . ' ›', 'node/' . $next->nid, array('attributes' => array('class' => array('page-next'), 'title' => t('Go to next page')))), t('Next page link found.'));
}
// Compute the expected breadcrumb.
@@ -140,7 +140,7 @@ class BookTestCase extends DrupalWebTestCase {
// Check printer friendly version.
$this->drupalGet('book/export/html/' . $node->nid);
- $this->assertText($node->title[LANGUAGE_NONE][0]['value'], t('Printer friendly title found.'));
+ $this->assertText($node->title, t('Printer friendly title found.'));
$this->assertRaw(check_markup($node->body[LANGUAGE_NONE][0]['value'], $node->body[LANGUAGE_NONE][0]['format']), t('Printer friendly body found.'));
$number++;
@@ -154,7 +154,7 @@ class BookTestCase extends DrupalWebTestCase {
function generateOutlinePattern($nodes) {
$outline = '';
foreach ($nodes as $node) {
- $outline .= '(node\/' . $node->nid . ')(.*?)(' . $node->title[LANGUAGE_NONE][0]['value'] . ')(.*?)';
+ $outline .= '(node\/' . $node->nid . ')(.*?)(' . $node->title . ')(.*?)';
}
return '/<div id="book-navigation-' . $this->book->nid . '"(.*?)<ul(.*?)' . $outline . '<\/ul>/s';
@@ -173,7 +173,7 @@ class BookTestCase extends DrupalWebTestCase {
$edit = array();
$langcode = LANGUAGE_NONE;
- $edit["title[$langcode][0][value]"] = $number . ' - SimpleTest test node ' . $this->randomName(10);
+ $edit["title"] = $number . ' - SimpleTest test node ' . $this->randomName(10);
$edit["body[$langcode][0][value]"] = 'SimpleTest test body ' . $this->randomName(32) . ' ' . $this->randomName(32);
$edit['book[bid]'] = $book_nid;
@@ -188,7 +188,7 @@ class BookTestCase extends DrupalWebTestCase {
}
// Check to make sure the book node was created.
- $node = $this->drupalGetNodeByTitle($edit["title[$langcode][0][value]"]);
+ $node = $this->drupalGetNodeByTitle($edit['title']);
$this->assertNotNull(($node === FALSE ? NULL : $node), t('Book node found in database.'));
$number++;