summaryrefslogtreecommitdiff
path: root/modules/node
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2009-10-15 12:44:36 +0000
committerDries Buytaert <dries@buytaert.net>2009-10-15 12:44:36 +0000
commit714597a9cdb42c3ca0df843f7f6a7351c6e06e39 (patch)
tree4e42239768111673ec7e8ae3181e7fa7339937c4 /modules/node
parent35e21e54e1122f98bede28f89d80f2fb13b3fd97 (diff)
downloadbrdo-714597a9cdb42c3ca0df843f7f6a7351c6e06e39.tar.gz
brdo-714597a9cdb42c3ca0df843f7f6a7351c6e06e39.tar.bz2
- Patch #470242 by yched, bjaspan: fixed namespacing for bundle names to avoid users rendering their site unusable.
Diffstat (limited to 'modules/node')
-rw-r--r--modules/node/node.module10
-rw-r--r--modules/node/node.test6
2 files changed, 9 insertions, 7 deletions
diff --git a/modules/node/node.module b/modules/node/node.module
index b4869de54..db50ea97a 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -491,7 +491,7 @@ function node_type_save($info) {
->execute();
if (!empty($type->old_type) && $type->old_type != $type->type) {
- field_attach_rename_bundle($type->old_type, $type->type);
+ field_attach_rename_bundle('node', $type->old_type, $type->type);
}
node_configure_fields($type);
module_invoke_all('node_type_update', $type);
@@ -503,7 +503,7 @@ function node_type_save($info) {
->fields($fields)
->execute();
- field_attach_create_bundle($type->type);
+ field_attach_create_bundle('node', $type->type);
node_configure_fields($type);
module_invoke_all('node_type_insert', $type);
$status = SAVED_NEW;
@@ -528,7 +528,7 @@ function node_type_save($info) {
function node_configure_fields($type) {
// Add or remove the body field, as needed.
$field = field_info_field('body');
- $instance = field_info_instance('body', $type->type);
+ $instance = field_info_instance('node', 'body', $type->type);
if ($type->has_body) {
if (empty($field)) {
$field = array(
@@ -540,6 +540,7 @@ function node_configure_fields($type) {
if (empty($instance)) {
$instance = array(
'field_name' => 'body',
+ 'object_type' => 'node',
'bundle' => $type->type,
'label' => $type->body_label,
'widget_type' => 'text_textarea_with_summary',
@@ -572,7 +573,7 @@ function node_configure_fields($type) {
if ($type->has_title) {
// Add the title field if not present.
$field = field_info_field('title');
- $instance = field_info_instance('title', $type->type);
+ $instance = field_info_instance('node', 'title', $type->type);
if (empty($field)) {
$field = array(
@@ -585,6 +586,7 @@ function node_configure_fields($type) {
$weight = -5;
$instance = array(
'field_name' => 'title',
+ 'object_type' => 'node',
'bundle' => $type->type,
'label' => $type->title_label,
'widget_type' => 'text',
diff --git a/modules/node/node.test b/modules/node/node.test
index a4f5f90e1..56cd251c0 100644
--- a/modules/node/node.test
+++ b/modules/node/node.test
@@ -871,7 +871,7 @@ class NodeTypeTestCase extends DrupalWebTestCase {
$web_user = $this->drupalCreateUser(array('bypass node access', 'administer content types'));
$this->drupalLogin($web_user);
- $instance = field_info_instance('body', 'page');
+ $instance = field_info_instance('node', 'body', 'page');
$this->assertEqual($instance['label'], 'Body', t('Body field was found.'));
// Verify that title and body fields are displayed.
@@ -887,7 +887,7 @@ class NodeTypeTestCase extends DrupalWebTestCase {
$this->drupalPost('admin/structure/types/manage/page', $edit, t('Save content type'));
field_info_cache_clear();
- $this->assertFalse(field_info_instance('body', 'page'), t('Body field was removed.'));
+ $this->assertFalse(field_info_instance('node', 'body', 'page'), t('Body field was removed.'));
$this->drupalGet('node/add/page');
$this->assertRaw('Foo', t('New title label was displayed.'));
$this->assertNoRaw('Title', t('Old title label was not displayed.'));
@@ -903,7 +903,7 @@ class NodeTypeTestCase extends DrupalWebTestCase {
$this->drupalPost('admin/structure/types/manage/page', $edit, t('Save content type'));
field_info_cache_clear();
- $instance = field_info_instance('body', 'bar');
+ $instance = field_info_instance('node', 'body', 'bar');
$this->assertEqual($instance['label'], 'Baz', t('Body field was added.'));
$this->drupalGet('node/add');
$this->assertRaw('Bar', t('New name was displayed.'));