Commit af6cd3da authored by alexpott's avatar alexpott

Issue #2083721 by benjy, longwave: 'block_body()' field could be renamed 'body'.

parent cfc1584e
......@@ -245,7 +245,7 @@ function block_update_8007() {
}
/**
* Migrate {block_custom}.body and {block_custom}.format to block_body field.
* Migrate {block_custom}.body and {block_custom}.format to body field.
*/
function block_update_8008() {
$sandbox['#finished'] = 0;
......@@ -255,7 +255,7 @@ function block_update_8008() {
// First, create the body field.
$body_field = array(
'name' => 'block_body',
'name' => 'body',
'entity_type' => 'custom_block',
'type' => 'text_with_summary',
'module' => 'text',
......@@ -346,7 +346,7 @@ function block_update_8008() {
);
// This is a core update and no contrib modules are enabled yet, so
// we can assume default field storage for a faster update.
_update_8006_field_write_data_sql('custom_block', 'basic', $block->bid, $block->bid, 'block_body', $data);
_update_8006_field_write_data_sql('custom_block', 'basic', $block->bid, $block->bid, 'body', $data);
$sandbox['last'] = $block->bid;
$sandbox['count'] += 1;
......
......@@ -202,11 +202,11 @@ function custom_block_entity_bundle_info() {
*/
function custom_block_add_body_field($block_type_id, $label = 'Block body') {
// Add or remove the body field, as needed.
$field = field_info_field('custom_block', 'block_body');
$instance = field_info_instance('custom_block', 'block_body', $block_type_id);
$field = field_info_field('custom_block', 'body');
$instance = field_info_instance('custom_block', 'body', $block_type_id);
if (empty($field)) {
$field = entity_create('field_entity', array(
'name' => 'block_body',
'name' => 'body',
'entity_type' => 'custom_block',
'type' => 'text_with_summary',
));
......@@ -214,7 +214,7 @@ function custom_block_add_body_field($block_type_id, $label = 'Block body') {
}
if (empty($instance)) {
$instance = entity_create('field_instance', array(
'field_name' => 'block_body',
'field_name' => 'body',
'entity_type' => 'custom_block',
'bundle' => $block_type_id,
'label' => $label,
......@@ -224,14 +224,14 @@ function custom_block_add_body_field($block_type_id, $label = 'Block body') {
// Assign widget settings for the 'default' form mode.
entity_get_form_display('custom_block', $block_type_id, 'default')
->setComponent('block_body', array(
->setComponent('body', array(
'type' => 'text_textarea_with_summary',
))
->save();
// Assign display settings for 'default' view mode.
entity_get_display('custom_block', $block_type_id, 'default')
->setComponent('block_body', array(
->setComponent('body', array(
'label' => 'hidden',
'type' => 'text_default',
))
......
......@@ -49,7 +49,7 @@ public function testCustomBlockCreation() {
// Create a block.
$edit = array();
$edit['info'] = $this->randomName(8);
$edit['block_body[0][value]'] = $this->randomName(16);
$edit['body[0][value]'] = $this->randomName(16);
$this->drupalPostForm('block/add/basic', $edit, t('Save'));
// Check that the Basic block has been created.
......@@ -83,7 +83,7 @@ public function testCustomBlockCreation() {
public function testDefaultCustomBlockCreation() {
$edit = array();
$edit['info'] = $this->randomName(8);
$edit['block_body[0][value]'] = $this->randomName(16);
$edit['body[0][value]'] = $this->randomName(16);
// Don't pass the custom block type in the url so the default is forced.
$this->drupalPostForm('block/add', $edit, t('Save'));
......@@ -144,7 +144,7 @@ public function testBlockDelete() {
$edit = array();
$edit['info'] = $this->randomName(8);
$body = $this->randomName(16);
$edit['block_body[0][value]'] = $body;
$edit['body[0][value]'] = $body;
$this->drupalPostForm('block/add/basic', $edit, t('Save'));
// Place the block.
......@@ -177,7 +177,7 @@ public function testBlockDelete() {
$edit2 = array();
$edit2['info'] = $this->randomName(8);
$body2 = $this->randomName(16);
$edit2['block_body[0][value]'] = $body2;
$edit2['body[0][value]'] = $body2;
$this->drupalPostForm('block/add/basic', $edit2, t('Save'));
$this->assertNoRaw('Error message');
......@@ -187,7 +187,7 @@ public function testBlockDelete() {
$edit3 = array();
$edit3['info'] = $this->randomName(8);
$body = $this->randomName(16);
$edit3['block_body[0][value]'] = $body;
$edit3['body[0][value]'] = $body;
$this->drupalPostForm('block/add/basic', $edit3, t('Save'));
// Show the delete confirm form.
......
......@@ -64,7 +64,7 @@ public function testListing() {
$this->assertResponse(200);
$edit = array();
$edit['info'] = $label;
$edit['block_body[0][value]'] = $this->randomName(16);
$edit['body[0][value]'] = $this->randomName(16);
$this->drupalPostForm(NULL, $edit, t('Save'));
// Confirm that once the user returns to the listing, the text of the label
......
......@@ -88,11 +88,11 @@ public function testRevisions() {
// Save this as a non-default revision.
$loaded->setNewRevision();
$loaded->isDefaultRevision = FALSE;
$loaded->block_body = $this->randomName(8);
$loaded->body = $this->randomName(8);
$loaded->save();
$this->drupalGet('block/' . $loaded->id->value);
$this->assertNoText($loaded->block_body->value, 'Revision body text is not present on default version of block.');
$this->assertNoText($loaded->body->value, 'Revision body text is not present on default version of block.');
// Verify that the non-default revision id is greater than the default
// revision id.
......
......@@ -51,7 +51,7 @@ public function testImport() {
$info = $this->randomName(8);
$block = array(
'info' => $info,
'block_body' => array(Language::LANGCODE_NOT_SPECIFIED => array(array('value' => $this->randomName(32)))),
'body' => array(Language::LANGCODE_NOT_SPECIFIED => array(array('value' => $this->randomName(32)))),
'type' => 'basic',
'id' => $test_id
);
......
......@@ -78,7 +78,7 @@ public function testCustomBlockTypeEditing() {
// We need two block types to prevent /block/add redirecting.
$this->createCustomBlockType('other');
$instance = field_info_instance('custom_block', 'block_body', 'basic');
$instance = field_info_instance('custom_block', 'body', 'basic');
$this->assertEqual($instance['label'], 'Block body', 'Body field was found.');
// Verify that title and body fields are displayed.
......@@ -99,7 +99,7 @@ public function testCustomBlockTypeEditing() {
$this->assertEqual(url('block/add/basic', array('absolute' => TRUE)), $this->getUrl(), 'Original machine name was used in URL.');
// Remove the body field.
$this->drupalPostForm('admin/structure/block/custom-blocks/manage/basic/fields/custom_block.basic.block_body/delete', array(), t('Delete'));
$this->drupalPostForm('admin/structure/block/custom-blocks/manage/basic/fields/custom_block.basic.body/delete', array(), t('Delete'));
// Resave the settings for this type.
$this->drupalPostForm('admin/structure/block/custom-blocks/manage/basic', array(), t('Save'));
// Check that the body field doesn't exist.
......
......@@ -32,7 +32,7 @@ public function testPageEdit() {
$this->drupalLogin($this->adminUser);
$title_key = 'info';
$body_key = 'block_body[0][value]';
$body_key = 'body[0][value]';
// Create block to edit.
$edit = array();
$edit['info'] = drupal_strtolower($this->randomName(8));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment