Commit e8251b2a authored by webchick's avatar webchick

Issue #2057199 by lauriii, olli: Unable to select the 'Default' view mode for custom block.

parent da7d7a95
...@@ -92,7 +92,7 @@ public function defaultConfiguration() { ...@@ -92,7 +92,7 @@ public function defaultConfiguration() {
* Adds body and description fields to the block configuration form. * Adds body and description fields to the block configuration form.
*/ */
public function blockForm($form, &$form_state) { public function blockForm($form, &$form_state) {
$options = array(); $options = array('default' => t('Default'));
$view_modes = entity_get_view_modes('custom_block'); $view_modes = entity_get_view_modes('custom_block');
foreach ($view_modes as $view_mode => $detail) { foreach ($view_modes as $view_mode => $detail) {
$options[$view_mode] = $detail['label']; $options[$view_mode] = $detail['label'];
......
...@@ -78,6 +78,10 @@ public function testCustomBlockCreation() { ...@@ -78,6 +78,10 @@ public function testCustomBlockCreation() {
$this->drupalGet('admin/structure/block/manage/testblock'); $this->drupalGet('admin/structure/block/manage/testblock');
$this->assertFieldByXPath('//select[@name="settings[custom_block][view_mode]"]/option[@selected="selected"]/@value', 'test_view_mode', 'View mode changed to Test View Mode'); $this->assertFieldByXPath('//select[@name="settings[custom_block][view_mode]"]/option[@selected="selected"]/@value', 'test_view_mode', 'View mode changed to Test View Mode');
// Test the available view mode options.
$this->assertOption('edit-settings-custom-block-view-mode', 'default', 'The default view mode is available.');
$this->assertOption('edit-settings-custom-block-view-mode', 'full', 'The full view mode is available.');
// Check that the block exists in the database. // Check that the block exists in the database.
$blocks = entity_load_multiple_by_properties('custom_block', array('info' => $edit['info'])); $blocks = entity_load_multiple_by_properties('custom_block', array('info' => $edit['info']));
$block = reset($blocks); $block = reset($blocks);
......
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