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

8.0.x
webchick 2013-12-10 22:34:11 -08:00
parent da7d7a95e2
commit e8251b2a5f
2 changed files with 5 additions and 1 deletions

View File

@ -92,7 +92,7 @@ class CustomBlockBlock extends BlockBase implements ContainerFactoryPluginInterf
* Adds body and description fields to the block configuration form.
*/
public function blockForm($form, &$form_state) {
$options = array();
$options = array('default' => t('Default'));
$view_modes = entity_get_view_modes('custom_block');
foreach ($view_modes as $view_mode => $detail) {
$options[$view_mode] = $detail['label'];

View File

@ -78,6 +78,10 @@ class CustomBlockCreationTest extends CustomBlockTestBase {
$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');
// 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.
$blocks = entity_load_multiple_by_properties('custom_block', array('info' => $edit['info']));
$block = reset($blocks);