Skip to content
Snippets Groups Projects
Unverified Commit b9fce45b authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3115223 by bnjmnm, lauriii, tedbow, xjm, alexpott: Remove Stable as a...

Issue #3115223 by bnjmnm, lauriii, tedbow, xjm, alexpott: Remove Stable as a base theme of core themes
parent f156b5c6
No related branches found
No related tags found
8 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!1012Issue #3226887: Hreflang on non-canonical content pages,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10,!596Issue #3046532: deleting an entity reference field, used in a contextual view, makes the whole site unrecoverable,!496Issue #2463967: Use .user.ini file for PHP settings,!144Issue #2666286: Clean up menu_ui to conform to Drupal coding standards,!16Draft: Resolve #2081585 "History storage",!13Resolve #2903456
Showing
with 187 additions and 165 deletions
......@@ -493,7 +493,7 @@ public function testEntityBundleDelete() {
*/
public function testExtensionValidation() {
\Drupal::service('module_installer')->install(['node']);
\Drupal::service('theme_installer')->install(['bartik']);
\Drupal::service('theme_installer')->install(['test_subtheme']);
$this->rebuildContainer();
$sync = $this->container->get('config.storage.sync');
......@@ -504,9 +504,9 @@ public function testExtensionValidation() {
$module_data = $this->container->get('extension.list.module')->getList();
$this->assertTrue(isset($module_data['node']->requires['text']), 'The Node module depends on the Text module.');
// Bartik depends on Stable.
unset($core['theme']['stable']);
unset($core['theme']['test_basetheme']);
$theme_data = \Drupal::service('theme_handler')->rebuildThemeData();
$this->assertTrue(isset($theme_data['bartik']->requires['stable']), 'The Bartik theme depends on the Stable theme.');
$this->assertTrue(isset($theme_data['test_subtheme']->requires['test_basetheme']), 'The Test Subtheme theme depends on the Test Basetheme theme.');
// This module does not exist.
$core['module']['does_not_exist'] = 0;
// This theme does not exist.
......@@ -516,7 +516,7 @@ public function testExtensionValidation() {
$this->drupalPostForm('admin/config/development/configuration', [], t('Import all'));
$this->assertText('The configuration cannot be imported because it failed validation for the following reasons:');
$this->assertText('Unable to uninstall the Text module since the Node module is installed.');
$this->assertText('Unable to uninstall the Stable theme since the Bartik theme is installed.');
$this->assertText('Unable to uninstall the Theme test base theme theme since the Theme test subtheme theme is installed.');
$this->assertText('Unable to install the does_not_exist module since it does not exist.');
$this->assertText('Unable to install the does_not_exist theme since it does not exist.');
}
......
......@@ -11,6 +11,7 @@
use Drupal\Core\Entity\ContentEntityType;
use Drupal\Core\Entity\ContentEntityTypeInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Extension\Exception\UnknownExtensionException;
/**
* Implements hook_removed_post_updates().
......@@ -125,3 +126,24 @@ function system_post_update_uninstall_classy() {
// depending on it.
}
}
/**
* Uninstall Stable if it is no longer needed.
*
* This needs to run after system_post_update_uninstall_classy(). This will be
* the case since getAvailableUpdateFunctions() returns an alphabetically sorted
* list of post_update hooks to be run.
*
* @see Drupal\Core\Update\UpdateRegistry::getAvailableUpdateFunctions()
*/
function system_post_update_uninstall_stable() {
/** @var \Drupal\Core\Extension\ThemeInstallerInterface $theme_installer */
$theme_installer = \Drupal::getContainer()->get('theme_installer');
try {
$theme_installer->uninstall(['stable']);
}
catch (\InvalidArgumentException | UnknownExtensionException $exception) {
// Exception is thrown if Stable wasn't installed or if there are themes
// depending on it.
}
}
......@@ -28,13 +28,14 @@ public function testUpdate() {
/** @var \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler */
$theme_handler = $this->container->get('theme_handler');
$this->assertTrue($theme_handler->themeExists('classy'));
$this->assertTrue($theme_handler->themeExists('seven'));
$this->runUpdates();
// Ensure that Classy is not installed after running updates.
$theme_handler->refreshInfo();
$this->assertFalse($theme_handler->themeExists('classy'));
$this->assertTrue($theme_handler->themeExists('stable'));
$this->assertTrue($theme_handler->themeExists('seven'));
}
/**
......
<?php
namespace Drupal\Tests\system\Functional\Update;
use Drupal\FunctionalTests\Update\UpdatePathTestBase;
/**
* Ensures that update hook uninstalls Stable when it's no longer needed.
*
* @group Update
* @see system_post_update_uninstall_stable()
*/
class StableUninstallUpdateTest extends UpdatePathTestBase {
/**
* {@inheritdoc}
*/
protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [
__DIR__ . '/../../../fixtures/update/drupal-8.8.0.bare.standard.php.gz',
];
}
/**
* Ensures that Stable is disabled if it's no longer needed.
*/
public function testUpdate() {
/** @var \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler */
$theme_handler = $this->container->get('theme_handler');
$this->assertTrue($theme_handler->themeExists('stable'));
$this->assertTrue($theme_handler->themeExists('seven'));
$this->runUpdates();
// Ensure that Stable is not installed after running updates.
$theme_handler->refreshInfo();
$this->assertFalse($theme_handler->themeExists('stable'));
$this->assertTrue($theme_handler->themeExists('seven'));
}
/**
* Ensures that updates run without errors when Stable is not installed.
*/
public function testUpdateStableNotInstalled() {
/** @var \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler */
$theme_handler = $this->container->get('theme_handler');
$theme_list = array_keys($theme_handler->listInfo());
/** @var \Drupal\Core\Extension\ThemeInstallerInterface $theme_installer */
$theme_installer = $this->container->get('theme_installer');
$theme_installer->install(['stark']);
$this->container->get('config.factory')
->getEditable('system.theme')
->set('default', 'stark')
->set('admin', '')
->save();
$theme_handler->refreshInfo();
// Uninstall all themes that were installed prior to enabling Stark.
$theme_installer->uninstall($theme_list);
// Ensure that Stable is not installed anymore.
$theme_handler->refreshInfo();
$this->assertFalse($theme_handler->themeExists('stable'));
$this->runUpdates();
$theme_handler->refreshInfo();
$this->assertFalse($theme_handler->themeExists('stable'));
}
/**
* Ensures that updates run without errors when Stable is still needed.
*/
public function testUpdateStableNeeded() {
/** @var \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler */
$theme_handler = $this->container->get('theme_handler');
/** @var \Drupal\Core\Extension\ThemeInstallerInterface $theme_installer */
$theme_installer = $this->container->get('theme_installer');
$theme_installer->install(['test_theme_depending_on_stable']);
$this->assertTrue($theme_handler->themeExists('stable'));
$this->runUpdates();
// Ensure that Stable is still installed after running tests.
$theme_handler->refreshInfo();
$this->assertTrue($theme_handler->themeExists('stable'));
}
}
type: theme
base theme: stable
name: 'Test theme depending on Stable'
version: VERSION
......@@ -275,20 +275,21 @@ fieldset {
* normalize.css 7.0.0.
*/
button,
input:not([type="file"]),
textarea {
line-height: 1.5rem;
}
optgroup {
optgroup,
input:not([type="file"]) {
line-height: normal;
}
/**
* Prevent regression due to -webkit-appearance being set to button in
* normalize.css 4.1.0.
* Prevent regression due to changes in normalize.css 4.1.0.
*/
::-webkit-file-upload-button {
-webkit-appearance: push-button;
font-family: Arial, Helvetica, sans-serif;
font-size: 1em;
}
ul,
......@@ -306,3 +307,14 @@ ul ol {
p {
margin-bottom: 1.28rem;
}
/**
* Prevent regression table/td/th rules removed in normalize.css 7.0.0.
*/
table {
border-collapse: collapse;
}
td,
th {
padding: 0;
}
/**
* @file
* Provides theme function for Ajax-related markup.
*
* This file is a temporary addition to the theme to override
* stable/drupal.ajax. This is to help surface potential issues that may arise
* once the theme no longer depends on stable/drupal.ajax.
* @todo delete this file in https://drupal.org/node/3111468
*/
(($, Drupal) => {
/**
* Provide a wrapper for the AJAX progress bar element.
*
* @param {jQuery} $element
* Progress bar element.
* @return {string}
* The HTML markup for the progress bar.
*/
Drupal.theme.ajaxProgressBar = $element =>
$('<div class="ajax-progress ajax-progress-bar"></div>').append($element);
})(jQuery, Drupal);
/**
* DO NOT EDIT THIS FILE.
* See the following change record for more information,
* https://www.drupal.org/node/2815083
* @preserve
**/
(function ($, Drupal) {
Drupal.theme.ajaxProgressBar = function ($element) {
return $('<div class="ajax-progress ajax-progress-bar"></div>').append($element);
};
})(jQuery, Drupal);
\ No newline at end of file
/**
* @file
* Theme elements for user password forms.
*
* This file is a temporary addition to the theme to override
* stable/drupal.user. This is to help surface potential issues that may arise
* once the theme no longer depends on stable/drupal.user.
*/
(Drupal => {
/**
* Constructs a password confirm message element
*
* @return {string}
* A string representing a DOM fragment.
*/
Drupal.theme.passwordConfirmMessage = translate =>
`<div aria-live="polite" aria-atomic="true" class="password-confirm-message js-password-confirm-message">${translate.confirmTitle} <span></span></div>`;
})(Drupal);
/**
* DO NOT EDIT THIS FILE.
* See the following change record for more information,
* https://www.drupal.org/node/2815083
* @preserve
**/
(function (Drupal) {
Drupal.theme.passwordConfirmMessage = function (translate) {
return "<div aria-live=\"polite\" aria-atomic=\"true\" class=\"password-confirm-message js-password-confirm-message\">".concat(translate.confirmTitle, " <span></span></div>");
};
})(Drupal);
\ No newline at end of file
......@@ -10,7 +10,6 @@
* - file_size: The size of the file.
*
* @see template_preprocess_file_link()
* @see stable_preprocess_image_widget()
*/
#}
{{ attach_library('umami/classy.file') }}
......
name: Umami
type: theme
base theme: stable
base theme: false
description: 'The theme used for the Umami food magazine demonstration site.'
version: VERSION
libraries:
......@@ -25,27 +25,9 @@ libraries-override:
theme:
layouts/fourcol_section/fourcol_section.css: layouts/fourcol_section/fourcol_section.css
# @todo remove this library override in https://drupal.org/node/3115223
filter/drupal.filter.admin:
css:
theme:
/core/themes/stable/css/filter/filter.admin.css: false
# @todo remove this library override in https://drupal.org/node/3115223
filter/drupal.filter:
css:
theme:
/core/themes/stable/css/filter/filter.admin.css: false
# @todo remove this library override in https://drupal.org/node/3111468
stable/drupal.ajax: umami/empty
# @todo remove this library override in https://drupal.org/node/3111468
stable/drupal.user: umami/empty
libraries-extend:
tour/tour-styling:
- umami/demo-umami-tour
# @todo remove this library extend in https://drupal.org/node/3111468
core/drupal.ajax:
- umami/temporary.ajax
core/drupal.dialog:
- umami/classy.dialog
core/drupal.dropbutton:
......
# Drupal throws an IncompleteLibraryDefinitionException if a base theme defined
# library is set to false in a subtheme's libraries-override. This empty library
# is used as a workaround.
# @see https://www.drupal.org/node/3098375
# @todo remove this in https://drupal.org/node/3111468
empty:
version: VERSION
css: {}
global:
version: VERSION
css:
......@@ -91,9 +82,6 @@ user:
css:
component:
css/components/user/user.css: { weight: -10 }
js:
# @todo remove this file from library in https://drupal.org/node/3111468
js/user.theme.temporary.js: {}
webfonts-open-sans:
remote: https://fonts.google.com
......@@ -254,11 +242,3 @@ classy.search-results:
css:
component:
css/classy/components/search-results.css: {}
# @todo remove library in https://drupal.org/node/3111468
temporary.ajax:
version: VERSION
js:
js/ajax.temporary.js: {}
dependencies:
- core/jquery
......@@ -152,3 +152,23 @@ function umami_preprocess_image_widget(&$variables) {
$variables['data']["file_{$file->id()}"]['filename']['#suffix'] = ' <span class="file-size">(' . format_size($file->getSize()) . ')</span> ';
}
}
/**
* Implements template_preprocess_links().
*
* This makes it so array keys of #links items are added as a class. This
* functionality was removed in Drupal 8.1, but still neccessary in some
* instances.
*
* @todo remove in https://drupal.org/node/3120962
*/
function umami_preprocess_links(&$variables) {
if (!empty($variables['links'])) {
foreach ($variables['links'] as $key => $value) {
if (!is_numeric($key)) {
$class = Html::getClass($key);
$variables['links'][$key]['attributes']->addClass($class);
}
}
}
}
......@@ -584,7 +584,7 @@ public function testUnmetDependency() {
$extensions['theme']['unknown_theme'] = 0;
// Add a module and a theme that depend on uninstalled extensions.
$extensions['module']['book'] = 0;
$extensions['theme']['bartik'] = 0;
$extensions['theme']['test_subtheme'] = 0;
$sync->write('core.extension', $extensions);
try {
......@@ -597,7 +597,7 @@ public function testUnmetDependency() {
'Unable to install the <em class="placeholder">unknown_module</em> module since it does not exist.',
'Unable to install the <em class="placeholder">Book</em> module since it requires the <em class="placeholder">Node, Text, Field, Filter, User</em> modules.',
'Unable to install the <em class="placeholder">unknown_theme</em> theme since it does not exist.',
'Unable to install the <em class="placeholder">Bartik</em> theme since it requires the <em class="placeholder">Stable</em> theme.',
'Unable to install the <em class="placeholder">Theme test subtheme</em> theme since it requires the <em class="placeholder">Theme test base theme</em> theme.',
'Configuration <em class="placeholder">config_test.dynamic.dotted.config</em> depends on the <em class="placeholder">unknown</em> configuration that will not exist after import.',
'Configuration <em class="placeholder">config_test.dynamic.dotted.existing</em> depends on the <em class="placeholder">config_test.dynamic.dotted.deleted</em> configuration that will not exist after import.',
'Configuration <em class="placeholder">config_test.dynamic.dotted.module</em> depends on the <em class="placeholder">unknown</em> module that will not be installed after import.',
......@@ -639,7 +639,7 @@ public function testUnmetDependency() {
'Unable to install the <em class="placeholder">unknown_module</em> module since it does not exist.',
'Unable to install the <em class="placeholder">Book</em> module since it requires the <em class="placeholder">Node, Text, Field, Filter, User</em> modules.',
'Unable to install the <em class="placeholder">unknown_theme</em> theme since it does not exist.',
'Unable to install the <em class="placeholder">Bartik</em> theme since it requires the <em class="placeholder">Stable</em> theme.',
'Unable to install the <em class="placeholder">Theme test subtheme</em> theme since it requires the <em class="placeholder">Theme test base theme</em> theme.',
'Configuration <em class="placeholder">config_test.dynamic.dotted.config</em> depends on the <em class="placeholder">unknown</em> configuration that will not exist after import.',
'Configuration <em class="placeholder">config_test.dynamic.dotted.existing</em> depends on the <em class="placeholder">config_test.dynamic.dotted.deleted</em> configuration that will not exist after import.',
'Configuration <em class="placeholder">config_test.dynamic.dotted.module</em> depends on the <em class="placeholder">unknown</em> module that will not be installed after import.',
......@@ -648,7 +648,7 @@ public function testUnmetDependency() {
'Unable to install the <em class="placeholder">unknown_module</em> module since it does not exist.',
'Unable to install the <em class="placeholder">Book</em> module since it requires the <em class="placeholder">Node, Text, Field, Filter, User</em> modules.',
'Unable to install the <em class="placeholder">unknown_theme</em> theme since it does not exist.',
'Unable to install the <em class="placeholder">Bartik</em> theme since it requires the <em class="placeholder">Stable</em> theme.',
'Unable to install the <em class="placeholder">Theme test subtheme</em> theme since it requires the <em class="placeholder">Theme test base theme</em> theme.',
'Configuration <em class="placeholder">config_test.dynamic.dotted.config</em> depends on configuration (<em class="placeholder">unknown, unknown2</em>) that will not exist after import.',
'Configuration <em class="placeholder">config_test.dynamic.dotted.existing</em> depends on the <em class="placeholder">config_test.dynamic.dotted.deleted</em> configuration that will not exist after import.',
'Configuration <em class="placeholder">config_test.dynamic.dotted.module</em> depends on modules (<em class="placeholder">unknown, Database Logging</em>) that will not be installed after import.',
......
......@@ -226,7 +226,6 @@ public function providerTestClassyCopies() {
'field--comment.html.twig',
'link-formatter-link-separate.html.twig',
'field.html.twig',
'file-link.html.twig',
'field--text-with-summary.html.twig',
'field--node--uid.html.twig',
'field--node--title.html.twig',
......@@ -488,7 +487,6 @@ public function providerTestClassyCopies() {
'field--comment.html.twig',
'link-formatter-link-separate.html.twig',
'field.html.twig',
'file-link.html.twig',
'field--text-with-summary.html.twig',
'field--node--uid.html.twig',
'field--node--title.html.twig',
......@@ -636,7 +634,6 @@ public function providerTestClassyCopies() {
'field--comment.html.twig',
'link-formatter-link-separate.html.twig',
'field.html.twig',
'file-link.html.twig',
'field--text-with-summary.html.twig',
'field--node--uid.html.twig',
'field--node--title.html.twig',
......
......@@ -15,7 +15,7 @@ class MaintenanceThemeTest extends KernelTestBase {
* Tests that the maintenance theme initializes the theme and its base themes.
*/
public function testMaintenanceTheme() {
$this->setSetting('maintenance_theme', 'seven');
$this->setSetting('maintenance_theme', 'test_subtheme');
// Get the maintenance theme loaded.
drupal_maintenance_theme();
......@@ -23,11 +23,11 @@ public function testMaintenanceTheme() {
$this->assertTrue(\Drupal::theme()->hasActiveTheme());
$active_theme = \Drupal::theme()->getActiveTheme();
$this->assertEquals('seven', $active_theme->getName());
$this->assertEquals('test_subtheme', $active_theme->getName());
$base_themes = $active_theme->getBaseThemeExtensions();
$base_theme_names = array_keys($base_themes);
$this->assertSame(['stable'], $base_theme_names);
$this->assertSame(['test_basetheme'], $base_theme_names);
}
}
......@@ -13,7 +13,7 @@
# changes.
name: Bartik
type: theme
base theme: stable
base theme: false
description: 'A flexible, recolorable theme with many regions and a responsive, mobile-first layout.'
package: Core
version: VERSION
......@@ -23,27 +23,7 @@ libraries:
- core/normalize
- bartik/global-styling
libraries-override:
# @todo remove this library override in https://drupal.org/node/3115223
filter/drupal.filter.admin:
css:
theme:
/core/themes/stable/css/filter/filter.admin.css: false
# @todo remove this library override in https://drupal.org/node/3115223
filter/drupal.filter:
css:
theme:
/core/themes/stable/css/filter/filter.admin.css: false
# @todo remove this library override in https://drupal.org/node/3111468
stable/drupal.ajax: bartik/empty
# @todo remove this library override in https://drupal.org/node/3111468
stable/drupal.user: bartik/empty
libraries-extend:
# @todo remove this library extend in https://drupal.org/node/3111468
# core/drupal.ajax:
# - bartik/temporary.ajax
core/drupal.dialog:
- bartik/classy.dialog
core/drupal.dropbutton:
......
# Drupal throws an IncompleteLibraryDefinitionException if a base theme defined
# library is set to false in a subtheme's libraries-override. This empty library
# is used as a workaround.
# @see https://www.drupal.org/node/3098375
# @todo remove this in https://drupal.org/node/3111468
empty:
version: VERSION
css: {}
global-styling:
version: VERSION
css:
......@@ -129,9 +120,6 @@ user:
css:
component:
css/components/user.css: { weight: -10 }
js:
# @todo remove this file from library in https://drupal.org/node/3111468
js/user.theme.temporary.js: {}
filter:
version: VERSION
......@@ -209,11 +197,3 @@ classy.search-results:
css:
component:
css/classy/components/search-results.css: {}
# @todo remove library in https://drupal.org/node/3111468
temporary.ajax:
version: VERSION
js:
js/ajax.temporary.js: {}
dependencies:
- core/jquery
......@@ -5,6 +5,7 @@
* Functions to support theming in the Bartik theme.
*/
use Drupal\Component\Utility\Html;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Template\Attribute;
use Drupal\views\Form\ViewsForm;
......@@ -177,3 +178,23 @@ function bartik_preprocess_image_widget(&$variables) {
$variables['data']["file_{$file->id()}"]['filename']['#suffix'] = ' <span class="file-size">(' . format_size($file->getSize()) . ')</span> ';
}
}
/**
* Implements template_preprocess_links().
*
* This makes it so array keys of #links items are added as a class. This
* functionality was removed in Drupal 8.1, but still neccessary in some
* instances.
*
* @todo remove in https://drupal.org/node/3120962
*/
function bartik_preprocess_links(&$variables) {
if (!empty($variables['links'])) {
foreach ($variables['links'] as $key => $value) {
if (!is_numeric($key)) {
$class = Html::getClass($key);
$variables['links'][$key]['attributes']->addClass($class);
}
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment