Commit 966da66f authored by Dries's avatar Dries

Issue #2057207 by dawehner, olli: Fixed Unable to select the 'Default' view...

Issue #2057207 by dawehner, olli: Fixed Unable to select the 'Default' view mode in views entity row plugin.
parent 24e2dc26
......@@ -95,7 +95,7 @@ public static function create(ContainerInterface $container, array $configuratio
protected function defineOptions() {
$options = parent::defineOptions();
$options['view_mode'] = array('default' => '');
$options['view_mode'] = array('default' => 'default');
return $options;
}
......@@ -119,7 +119,7 @@ public function buildOptionsForm(&$form, &$form_state) {
* Return the main options, which are shown in the summary title.
*/
protected function buildViewModeOptions() {
$options = array();
$options = array('default' => t('Default'));
$view_modes = entity_get_view_modes($this->entityType);
foreach ($view_modes as $mode => $settings) {
$options[$mode] = $settings['label'];
......
......@@ -53,6 +53,7 @@ protected function setUp() {
$this->installSchema('system', array('menu_router'));
$this->installSchema('taxonomy', array('taxonomy_term_data', 'taxonomy_term_hierarchy'));
$this->installConfig(array('taxonomy'));
}
/**
......@@ -69,6 +70,15 @@ public function testEntityRow() {
$this->content = drupal_render($this->content);
$this->assertText($term->label(), 'The rendered entity appears as row in the view.');
// Tests the available view mode options.
$form = array();
$form_state = array();
$form_state['view'] = $view->storage;
$view->rowPlugin->buildOptionsForm($form, $form_state);
$this->assertTrue(isset($form['view_mode']['#options']['full']), 'Ensure that the full view mode is available');
$this->assertTrue(isset($form['view_mode']['#options']['default']), 'Ensure that the default view mode is available');
}
/**
......
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