Skip to content
Snippets Groups Projects
Commit c7065a89 authored by catch's avatar catch
Browse files

Issue #2057203 by olli: Fixed Unable to select the 'Default' view mode in...

Issue #2057203 by olli: Fixed Unable to select the 'Default' view mode in views entity area handler.
parent e4512d63
Branches
Tags
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -46,7 +46,7 @@ protected function defineOptions() {
$options['tokenize']['default'] = TRUE;
$options['entity_id'] = array('default' => '');
$options['view_mode'] = array('default' => '');
$options['view_mode'] = array('default' => 'default');
return $options;
}
......@@ -79,7 +79,7 @@ public function buildOptionsForm(&$form, &$form_state) {
* All view modes of the entity type.
*/
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'];
......
......@@ -111,6 +111,15 @@ public function testEntityArea() {
$result = $this->xpath('//div[@class = "view-header"]');
$this->assertTrue(strpos(trim((string) $result[0]), $entities[0]->label()) !== FALSE, 'The rendered entity appears in the header of the view.');
$this->assertTrue(strpos(trim((string) $result[0]), 'test') !== FALSE, 'The rendered entity appeared in the right view mode.');
// Test the available view mode options.
$form = array();
$form_state = array();
$form_state['type'] = 'header';
$view->display_handler->getHandler('header', 'entity_entity_test_render')->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']['test']), 'Ensure that the test view mode is available.');
$this->assertTrue(isset($form['view_mode']['#options']['default']), 'Ensure that the default view mode is available.');
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment