diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-10-11 03:07:21 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-10-11 03:07:21 +0000 |
commit | b3265dbe174ce0efefa181b8af6c1eaea3ff22c2 (patch) | |
tree | aa7e8b709c162fd781748d8bebaa12c75727e01e /modules/forum | |
parent | 64a1a0d67eb5aecc8e6d78469b19f58e8443c717 (diff) | |
download | brdo-b3265dbe174ce0efefa181b8af6c1eaea3ff22c2.tar.gz brdo-b3265dbe174ce0efefa181b8af6c1eaea3ff22c2.tar.bz2 |
#557292 by peximo, plach, catch, and yched: Convert node title to Field API.
Diffstat (limited to 'modules/forum')
-rw-r--r-- | modules/forum/forum.module | 5 | ||||
-rw-r--r-- | modules/forum/forum.test | 12 |
2 files changed, 8 insertions, 9 deletions
diff --git a/modules/forum/forum.module b/modules/forum/forum.module index 1d494b2eb..95c0337e6 100644 --- a/modules/forum/forum.module +++ b/modules/forum/forum.module @@ -431,7 +431,7 @@ function forum_field_attach_pre_insert($obj_type, $object, $skip_fields) { foreach ($language as $delta) { $query->values(array( 'nid' => $object->nid, - 'title' => $object->title, + 'title' => $object->title[FIELD_LANGUAGE_NONE][0]['value'], 'tid' => $delta['value'], 'sticky' => $object->sticky, 'created' => $object->created, @@ -606,8 +606,7 @@ function forum_block_view_pre_render($elements) { */ function forum_form($node, $form_state) { $type = node_type_get_type($node); - $form['title'] = array('#type' => 'textfield', '#title' => check_plain($type->title_label), '#default_value' => !empty($node->title) ? $node->title : '', '#required' => TRUE, '#weight' => -5); - + if (!empty($node->nid)) { $forum_terms = $node->taxonomy_forums; // If editing, give option to leave shadows diff --git a/modules/forum/forum.test b/modules/forum/forum.test index 4496949b9..28995361f 100644 --- a/modules/forum/forum.test +++ b/modules/forum/forum.test @@ -248,7 +248,7 @@ class ForumTestCase extends DrupalWebTestCase { $langcode = FIELD_LANGUAGE_NONE; $edit = array( - 'title' => $title, + "title[$langcode][0][value]" => $title, "body[$langcode][0][value]" => $body, "taxonomy_forums[$langcode][value]" => $tid, ); @@ -323,27 +323,27 @@ class ForumTestCase extends DrupalWebTestCase { // View forum node. $this->drupalGet('node/' . $node->nid); $this->assertResponse(200); - $this->assertTitle($node->title . ' | Drupal', t('Forum node was displayed')); + $this->assertTitle($node->title[FIELD_LANGUAGE_NONE][0]['value'] . ' | Drupal', t('Forum node was displayed')); $this->assertText(t('Home ' . $crumb . ' Forums ' . $crumb . ' @container ' . $crumb . ' @forum', array('@container' => $this->container['name'], '@forum' => $this->forum['name'])), t('Breadcrumbs were displayed')); // View forum edit node. $this->drupalGet('node/' . $node->nid . '/edit'); $this->assertResponse($response); if ($response == 200) { - $this->assertTitle('Edit Forum topic ' . $node->title . ' | Drupal', t('Forum edit node was displayed')); + $this->assertTitle('Edit Forum topic ' . $node->title[FIELD_LANGUAGE_NONE][0]['value'] . ' | Drupal', t('Forum edit node was displayed')); } if ($response == 200) { // Edit forum node (including moving it to another forum). $edit = array(); - $edit['title'] = 'node/' . $node->nid; $langcode = FIELD_LANGUAGE_NONE; + $edit["title[$langcode][0][value]"] = 'node/' . $node->nid; $edit["body[$langcode][0][value]"] = $this->randomName(256); // Assume the topic is initially associated with $forum. $edit["taxonomy_forums[$langcode][value]"] = $this->root_forum['tid']; $edit['shadow'] = TRUE; $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save')); - $this->assertRaw(t('Forum topic %title has been updated.', array('%title' => $edit['title'])), t('Forum node was edited')); + $this->assertRaw(t('Forum topic %title has been updated.', array('%title' => $edit["title[$langcode][0][value]"])), t('Forum node was edited')); // Verify topic was moved to a different forum. $forum_tid = db_query("SELECT tid FROM {forum} WHERE nid = :nid AND vid = :vid", array( @@ -355,7 +355,7 @@ class ForumTestCase extends DrupalWebTestCase { // Delete forum node. $this->drupalPost('node/' . $node->nid . '/delete', array(), t('Delete')); $this->assertResponse($response); - $this->assertRaw(t('Forum topic %title has been deleted.', array('%title' => $edit['title'])), t('Forum node was deleted')); + $this->assertRaw(t('Forum topic %title has been deleted.', array('%title' => $edit["title[$langcode][0][value]"])), t('Forum node was deleted')); } } |