Closes #3103069 Fix theme negotiator and add some tests.
4 open threads
Merge request reports
Activity
added 1 commit
- 09fa4130 - Add additional test, and rearrange array, for better review
84 110 $options = []; 85 foreach ($this->configFactory->get('system.theme.data') as $theme_name => $theme_extension) { 86 $options[$theme_name] = $theme_extension->info['name']; 111 // Get the list of enabled themes using the injected extension list service. 112 $enabled_themes = $this->themeList->getList(); 113 foreach ($enabled_themes as $theme_name => $theme) { 114 if ($theme->status === 0) { 115 // Skip disabled themes. 116 continue; 117 } 118 if (!empty($theme->info['hidden'])) { 119 // Skip hidden themes. 120 continue; 121 } 122 // Use the theme's human-readable name for the option text. 123 $options[$theme_name] = $theme->info['name']; - Comment on lines -85 to +123
111 // Get the list of enabled themes using the injected extension list service. 112 $enabled_themes = $this->themeList->getList(); 113 foreach ($enabled_themes as $theme_name => $theme) { 114 if ($theme->status === 0) { 115 // Skip disabled themes. 116 continue; 117 } 118 if (!empty($theme->info['hidden'])) { 119 // Skip hidden themes. 120 continue; 121 } 122 // Use the theme's human-readable name for the option text. 123 $options[$theme_name] = $theme->info['name']; 111 // Get the list of enabled themes using the injected extension list service. 112 $installed_themes = $this->themeList->getAllInstalledInfo(); 113 114 $options = []; 115 foreach ($installed_themes as $theme_name => $theme_extension) { 116 $options[$theme_name] = $theme_extension['name']; 117 } 118 119 return $options; Can void having to filter by just asking the listing service for the installed themes.
17 * Common modules to install for form_mode_manager_theme_switcher. 18 * 19 * @var string[] 20 */ 21 protected static $modules = [ 22 'entity_test', 23 'field', 24 'field_ui', 25 'media', 26 'block', 27 'block_content', 28 'node', 29 'user', 30 'form_mode_manager', 31 'form_mode_manager_examples', 32 'form_mode_manager_theme_switcher', 19 protected static $modules = [ 20 'entity_test', 21 'field', 22 'field_ui', 23 'media', 24 'block', 25 'block_content', 26 'node', 27 'user', 28 'form_mode_manager', 29 'taxonomy', 30 'path', 31 'menu_ui', 32 'form_mode_manager', 33 'form_mode_manager_examples', 34 'form_mode_manager_theme_switcher', - Comment on lines +27 to +34
27 'user', 28 'form_mode_manager', 29 'taxonomy', 30 'path', 31 'menu_ui', 32 'form_mode_manager', 33 'form_mode_manager_examples', 34 'form_mode_manager_theme_switcher', 27 'user', 28 'form_mode_manager', 29 'taxonomy', 30 'path', 31 'menu_ui', 32 'form_mode_manager_theme_switcher', Double up and no need for examples.
94 ]); 95 $this->drupalLogin($admin_user); 96 97 // Get the form url from the defined route. 98 $form_mode_theme_settings_url = Url::fromRoute('form_mode_manager.theme_switcher_settings'); 99 100 // Go to the URL. 101 $this->drupalGet($form_mode_theme_settings_url); 102 103 // Define the form field name for theme type. 104 $form_field_name = 'node.contributor_theme_type'; 105 106 // Set the form field value to _custom, this assumes that changing this 107 // field triggers an AJAX request. 108 $this->getSession()->getPage()->selectFieldOption($form_field_name, '_custom'); 109 $this->assertTrue($this->assertSession()->optionExists('node.contributor_theme_form_mode', 'olivero')->isSelected()); There's no need for the option to have been selected is there? Just that it exists would satisfy the test. Same with the other option select assertion in testFormModeThemeSwitcherFormEnabledThemes().
Edited by Ted Cooper
added 4 commits
-
756ffefc...6d54e337 - 3 commits from branch
project:8.x-2.x
- c81fa8ba - Merge branch '8.x-2.x' into form_mode_manager-3103069-fix-theme-negotiator
-
756ffefc...6d54e337 - 3 commits from branch
Please register or sign in to reply