Commit 3c80c6ae authored by effulgentsia's avatar effulgentsia

Issue #3079738 by lauriii, saschaeggi, webchick, xjm, andrewmacpherson,...

Issue #3079738 by lauriii, saschaeggi, webchick, xjm, andrewmacpherson, shimpy, effulgentsia, Wim Leers, DyanneNova, svettes, rainbreaw, fhaeberle, ckrina, AaronMcHale, justafish, catch, charlieweb82, AntoineH, lot007, pzajacz, kostyashupenko, jasonbarrie, antonellasevero, finnsky, worldlinemine, bnjmnm, RobLoach, Dennis Cohn, huzooka, Archita Arora, joachim, jrockowitz, benjifisher, shaal, Gábor Hojtsy, quiron, L2G2, ccasals, hampercm, if-jds, abhisekmazumdar, Kami Amiga, pivica, zrpnr, BrightBold, imalabya, jhedstrom, Neslee Canil Pinto, maliknaik, junaidmasoodi, Maithri Shetty, pranav73, mandclu, modulist, nod_, philosurfer, phenaproxima, mherchel, mlncn, rafuel92, leymannx, kiboman, Swapnil_Kotwal, anevins, evankay, rfmarcelino, thamas, brianperry, idebr, joelpittet, boulaffasae, alexpott, volkerk, DuneBL, Eli-T, Mahenkvyas22: Add Claro administration theme to core

(cherry picked from commit 1786bc19)
parent bd2b7454
themes/claro/**/*.css
!themes/claro/**/*.pcss.css
......@@ -65,6 +65,7 @@
"drupal/book": "self.version",
"drupal/breakpoint": "self.version",
"drupal/ckeditor": "self.version",
"drupal/claro": "self.version",
"drupal/classy": "self.version",
"drupal/color": "self.version",
"drupal/comment": "self.version",
......
......@@ -52,8 +52,13 @@ function shortcut_schema() {
function shortcut_install() {
// Theme settings are not configuration entities and cannot depend on modules
// so to set a module-specific setting, we need to set it with logic.
if (\Drupal::service('theme_handler')->themeExists('seven')) {
\Drupal::configFactory()->getEditable('seven.settings')->set('third_party_settings.shortcut.module_link', TRUE)->save(TRUE);
foreach (['seven', 'claro'] as $theme) {
if (\Drupal::service('theme_handler')->themeExists($theme)) {
\Drupal::configFactory()
->getEditable("$theme.settings")
->set('third_party_settings.shortcut.module_link', TRUE)
->save(TRUE);
}
}
}
......@@ -63,7 +68,12 @@ function shortcut_install() {
function shortcut_uninstall() {
// Theme settings are not configuration entities and cannot depend on modules
// so to unset a module-specific setting, we need to unset it with logic.
if (\Drupal::service('theme_handler')->themeExists('seven')) {
\Drupal::configFactory()->getEditable('seven.settings')->clear('third_party_settings.shortcut')->save(TRUE);
foreach (['seven', 'claro'] as $theme) {
if (\Drupal::service('theme_handler')->themeExists($theme)) {
\Drupal::configFactory()
->getEditable("$theme.settings")
->clear('third_party_settings.shortcut')
->save(TRUE);
}
}
}
......@@ -435,11 +435,13 @@ function shortcut_toolbar() {
* Implements hook_themes_installed().
*/
function shortcut_themes_installed($theme_list) {
if (in_array('seven', $theme_list)) {
// Theme settings are not configuration entities and cannot depend on modules
// so to set a module-specific setting, we need to set it with logic.
if (\Drupal::moduleHandler()->moduleExists('shortcut')) {
\Drupal::configFactory()->getEditable('seven.settings')->set('third_party_settings.shortcut.module_link', TRUE)->save(TRUE);
foreach (['seven', 'claro'] as $theme) {
if (in_array($theme, $theme_list, TRUE)) {
\Drupal::configFactory()->getEditable("$theme.settings")
->set('third_party_settings.shortcut.module_link', TRUE)
->save(TRUE);
}
}
}
<?php
namespace Drupal\FunctionalJavascriptTests\Theme;
use Drupal\Tests\block\FunctionalJavascript\BlockFilterTest;
/**
* Runs BlockFilterTest in Claro.
*
* @group block
*
* @see \Drupal\Tests\block\FunctionalJavascript\BlockFilterTest.
*/
class ClaroBlockFilterTest extends BlockFilterTest {
/**
* Modules to enable.
*
* Install the shortcut module so that claro.settings has its schema checked.
* There's currently no way for Claro to provide a default and have valid
* configuration as themes cannot react to a module install.
*
* @var string[]
*/
public static $modules = ['shortcut'];
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->container->get('theme_installer')->install(['claro']);
$this->config('system.theme')->set('default', 'claro')->save();
}
}
<?php
namespace Drupal\FunctionalJavascriptTests\Theme;
use Drupal\Tests\field_ui\FunctionalJavascript\EntityDisplayTest;
/**
* Runs EntityDisplayTest in Claro.
*
* @group claro
*
* @see \Drupal\Tests\field_ui\FunctionalJavascript\EntityDisplayTest.
*/
class ClaroEntityDisplayTest extends EntityDisplayTest {
/**
* Modules to enable.
*
* Install the shortcut module so that claro.settings has its schema checked.
* There's currently no way for Claro to provide a default and have valid
* configuration as themes cannot react to a module install.
*
* @var string[]
*/
public static $modules = ['shortcut'];
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->container->get('theme_installer')->install(['claro']);
$this->config('system.theme')->set('default', 'claro')->save();
}
/**
* Copied from parent.
*
* This is Drupal\Tests\field_ui\FunctionalJavascript\EntityDisplayTest::testEntityForm()
* with a line changed to reflect row weight toggle being a link instead
* of a button.
*/
public function testEntityForm() {
$this->drupalGet('entity_test/manage/1/edit');
$this->assertSession()->fieldExists('field_test_text[0][value]');
$this->drupalGet('entity_test/structure/entity_test/form-display');
$this->assertTrue($this->assertSession()->optionExists('fields[field_test_text][region]', 'content')->isSelected());
$this->getSession()->getPage()->clickLink('Show row weights');
$this->assertSession()->waitForElementVisible('css', '[name="fields[field_test_text][region]"]');
$this->getSession()->getPage()->selectFieldOption('fields[field_test_text][region]', 'hidden');
$this->assertSession()->assertWaitOnAjaxRequest();
$this->assertTrue($this->assertSession()->optionExists('fields[field_test_text][region]', 'hidden')->isSelected());
$this->submitForm([], 'Save');
$this->assertSession()->pageTextContains('Your settings have been saved.');
$this->assertTrue($this->assertSession()->optionExists('fields[field_test_text][region]', 'hidden')->isSelected());
$this->drupalGet('entity_test/manage/1/edit');
$this->assertSession()->fieldNotExists('field_test_text[0][value]');
}
/**
* Copied from parent.
*
* This is Drupal\Tests\field_ui\FunctionalJavascript\EntityDisplayTest::testEntityView()
* with a line changed to reflect row weight toggle being a link instead
* of a button.
*/
public function testEntityView() {
$this->drupalGet('entity_test/1');
$this->assertSession()->elementNotExists('css', '.field--name-field-test-text');
$this->drupalGet('entity_test/structure/entity_test/display');
$this->assertSession()->elementExists('css', '.region-content-message.region-empty');
$this->getSession()->getPage()->clickLink('Show row weights');
$this->assertSession()->waitForElementVisible('css', '[name="fields[field_test_text][region]"]');
$this->assertTrue($this->assertSession()->optionExists('fields[field_test_text][region]', 'hidden')->isSelected());
$this->getSession()->getPage()->selectFieldOption('fields[field_test_text][region]', 'content');
$this->assertSession()->assertWaitOnAjaxRequest();
$this->assertTrue($this->assertSession()->optionExists('fields[field_test_text][region]', 'content')->isSelected());
$this->submitForm([], 'Save');
$this->assertSession()->pageTextContains('Your settings have been saved.');
$this->assertTrue($this->assertSession()->optionExists('fields[field_test_text][region]', 'content')->isSelected());
$this->drupalGet('entity_test/1');
$this->assertSession()->elementExists('css', '.field--name-field-test-text');
}
/**
* Copied from parent.
*
* This is Drupal\Tests\field_ui\FunctionalJavascript\EntityDisplayTest::testExtraFields()
* with a line changed to reflect Claro's tabledrag selector.
*/
public function testExtraFields() {
entity_test_create_bundle('bundle_with_extra_fields');
$this->drupalGet('entity_test/structure/bundle_with_extra_fields/display');
$this->assertSession()->waitForElement('css', '.tabledrag-handle');
$id = $this->getSession()->getPage()->find('css', '[name="form_build_id"]')->getValue();
$extra_field_row = $this->getSession()->getPage()->find('css', '#display-extra-field');
$disabled_region_row = $this->getSession()->getPage()->find('css', '.region-hidden-title');
$extra_field_row->find('css', '.js-tabledrag-handle')->dragTo($disabled_region_row);
$this->assertSession()->assertWaitOnAjaxRequest();
$this->assertSession()
->waitForElement('css', "[name='form_build_id']:not([value='$id'])");
$this->submitForm([], 'Save');
$this->assertSession()->pageTextContains('Your settings have been saved.');
}
}
<?php
namespace Drupal\FunctionalJavascriptTests\Theme;
use Drupal\Tests\menu_ui\FunctionalJavascript\MenuUiJavascriptTest;
/**
* Runs MenuUiJavascriptTest in Claro.
*
* @group claro
*
* @see \Drupal\Tests\menu_ui\FunctionalJavascript\MenuUiJavascriptTest;
*/
class ClaroMenuUiJavascriptTest extends MenuUiJavascriptTest {
/**
* {@inheritdoc}
*/
protected static $modules = [
'shortcut',
];
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->container->get('theme_installer')->install(['claro']);
$this->config('system.theme')->set('default', 'claro')->save();
}
/**
* Intentionally empty method.
*
* Contextual links do not work in admin themes, so this is empty to prevent
* this test running in the parent class.
*/
public function testBlockContextualLinks() {
}
}
<?php
namespace Drupal\FunctionalTests\Theme;
use Drupal\Tests\BrowserTestBase;
/**
* Tests the Claro theme.
*
* @group claro
*/
class ClaroTest extends BrowserTestBase {
/**
* Modules to enable.
*
* Install the shortcut module so that claro.settings has its schema checked.
* There's currently no way for Claro to provide a default and have valid
* configuration as themes cannot react to a module install.
*
* @var string[]
*/
public static $modules = ['shortcut'];
/**
* {@inheritdoc}
*/
public function setUp() {
parent::setUp();
$this->assertTrue(\Drupal::service('theme_installer')->install(['claro']));
$this->container->get('config.factory')
->getEditable('system.theme')
->set('default', 'claro')
->save();
}
/**
* Tests that the Claro theme always adds its elements.css.
*
* @see claro.info.yml
*/
public function testRegressionMissingElementsCss() {
$this->drupalGet('');
$this->assertSession()->statusCodeEquals(200);
$this->assertSession()->responseContains('claro/css/src/base/elements.css');
$this->drupalLogin($this->rootUser);
$this->drupalGet('admin/modules');
$this->assertSession()->elementNotExists('css', '#block-claro-help');
// Install the block module to ensure Claro's configuration is valid
// according to schema.
\Drupal::service('module_installer')->install(['block', 'help']);
$this->rebuildAll();
$this->drupalGet('admin/modules');
$this->assertSession()->elementExists('css', '#block-claro-help');
}
/**
* Tests that the Claro theme can be uninstalled, despite being experimental.
*
* @todo Remove in https://www.drupal.org/project/drupal/issues/3066007
*/
public function testIsUninstallable() {
$this->drupalLogin($this->drupalCreateUser(['access administration pages', 'administer themes']));
$this->drupalGet('admin/appearance');
$this->cssSelect('a[title="Install Seven as default theme"]')[0]->click();
$this->cssSelect('a[title="Uninstall Claro theme"]')[0]->click();
$this->assertText('The Claro theme has been uninstalled.');
}
}
# This theme is marked as @internal. It is intended to evolve and change over
# minor releases.
# Change record https://www.drupal.org/node/2582945.
# As the UI of Drupal improves between minor versions, the markup and assets
# in the Claro theme will change. The Claro theme is not backwards compatible.
# If you wish to modify the output or assets of Claro you can:
# 1. Copy the whole of Claro and rename it as your own administration theme. You
# will need to manually manage your own updates if you want to stay up to
# date with Claro's bug fixes and feature support.
#
# 2. Sub-theme Claro. This is only recommended if you want to make minor tweaks
# and understand that Claro could break your modifications as it changes.
name: Claro
type: theme
base theme: classy
description: 'A clean, accessible, and powerful Drupal administration theme.'
alt text: 'Screenshot of Claro, Drupal administration theme.'
package: Core
version: VERSION
experimental: true
core: 8.x
libraries:
- claro/global-styling
libraries-override:
system/base:
css:
component:
/core/themes/stable/css/system/components/ajax-progress.module.css: css/src/components/ajax-progress.module.css
/core/themes/stable/css/system/components/autocomplete-loading.module.css: css/src/components/autocomplete-loading.module.css
/core/themes/stable/css/system/components/system-status-counter.css: css/src/components/system-status-counter.css
/core/themes/stable/css/system/components/system-status-report-counters.css: css/src/components/system-status-report-counters.css
/core/themes/stable/css/system/components/system-status-report-general-info.css: css/src/components/system-status-report-general-info.css
/core/themes/stable/css/system/components/tabledrag.module.css: css/src/components/tabledrag.css
system/admin:
css:
theme:
/core/themes/stable/css/system/system.admin.css: false
core/drupal.dropbutton:
css:
component:
/core/themes/stable/css/core/dropbutton/dropbutton.css: css/src/components/dropbutton.css
core/drupal.tabledrag:
js:
misc/tabledrag.js: js/tabledrag.js
core/drupal.vertical-tabs:
css:
component:
/core/themes/stable/css/core/vertical-tabs.css: false
js:
misc/vertical-tabs.js: js/vertical-tabs.js
core/jquery.ui:
css:
theme:
assets/vendor/jquery.ui/themes/base/theme.css: false
core/jquery.ui.dialog:
css:
component:
assets/vendor/jquery.ui/themes/base/dialog.css: false
classy/dialog: claro/claro.drupal.dialog
classy/base:
css:
component:
css/components/action-links.css: false
css/components/breadcrumb.css: false
css/components/button.css: false
css/components/details.css: false
css/components/dropbutton.css: false
css/components/form.css: false
css/components/tabs.css: false
css/components/pager.css: false
css/components/tableselect.css: css/src/components/tableselect.css
css/components/tabledrag.css: false
css/components/collapse-processed.css: false
classy/dropbutton:
css:
component:
css/components/dropbutton.css: false
classy/messages:
css:
component:
css/components/messages.css: false
classy/progress:
css:
component:
css/components/progress.css: css/src/components/progress.css
# @todo Refactor when https://www.drupal.org/node/2642122 is fixed.
classy/user: false
user/drupal.user: claro/form.password-confirm
field_ui/drupal.field_ui:
css:
theme:
/core/themes/stable/css/field_ui/field_ui.admin.css: css/src/theme/field-ui.admin.css
filter/drupal.filter.admin:
css:
theme:
/core/themes/stable/css/filter/filter.admin.css: css/src/theme/filter.theme.css
filter/drupal.filter:
css:
theme:
/core/themes/stable/css/filter/filter.admin.css: css/src/theme/filter.theme.css
views_ui/admin.styling:
css:
theme:
/core/themes/stable/css/views_ui/views_ui.admin.theme.css: css/src/theme/views_ui.admin.theme.css
libraries-extend:
ckeditor/drupal.ckeditor:
- claro/ckeditor-editor
classy/image-widget:
- claro/image-widget
core/ckeditor:
- claro/ckeditor-dialog
core/drupal.collapse:
- claro/details-focus
core/drupal.dropbutton:
- claro/dropbutton
core/drupal.checkbox:
- claro/checkbox
core/drupal.message:
- claro/messages
core/drupal.vertical-tabs:
- claro/vertical-tabs
core/jquery.ui:
- claro/claro.jquery.ui
file/drupal.file:
- claro/file
system/admin:
- claro/system.admin
core/drupal.autocomplete:
- claro/autocomplete
tour/tour-styling:
- claro/tour-styling
shortcut/drupal.shortcut:
- claro/drupal.shortcut
core/drupal.ajax:
- claro/ajax
views/views.module:
- claro/views
quickedit_stylesheets:
- css/src/components/quickedit.css
ckeditor_stylesheets:
- css/src/base/elements.css
- css/src/base/typography.css
- css/src/theme/ckeditor-frame.css
regions:
header: 'Header'
pre_content: 'Pre-content'
breadcrumb: Breadcrumb
highlighted: Highlighted
help: Help
content: Content
page_top: 'Page top'
page_bottom: 'Page bottom'
sidebar_first: 'First sidebar'
regions_hidden:
- sidebar_first
global-styling:
version: VERSION
css:
base:
css/src/base/elements.css: {}
css/src/base/typography.css: {}
css/src/base/print.css: {}
component:
css/src/components/accordion.css: {}
css/src/components/action-link.css: {}
css/src/components/content-header.css: {}
css/src/components/container-inline.css: {}
css/src/components/container-inline.module.css: {}
css/src/components/breadcrumb.css: {}
css/src/components/button.css: {}
css/src/components/details.css: {}
css/src/components/divider.css: {}
css/src/components/messages.css: {}
css/src/components/entity-meta.css: {}
css/src/components/fieldset.css: {}
css/src/components/form.css: {}
css/src/components/form--checkbox-radio.css: {}
css/src/components/form--checkbox-radio--ie.css: {}
css/src/components/form--field-multiple.css: {}
css/src/components/form--managed-file.css: {}
css/src/components/form--text.css: {}
css/src/components/form--select.css: {}
css/src/components/help.css: {}
css/src/components/image-preview.css: {}
css/src/components/menus-and-lists.css: {}
css/src/components/modules-page.css: {}
css/src/components/node.css: {}
css/src/components/page-title.css: {}
css/src/components/pager.css: {}
css/src/components/skip-link.css: {}
css/src/components/tables.css: {}
css/src/components/table--file-multiple-widget.css: {}
css/src/components/search-admin-settings.css: {}
css/src/components/tablesort-indicator.css: {}
css/src/components/system-status-report-general-info.css: {}
css/src/components/system-status-report.css: {}
css/src/components/system-status-report-counters.css: {}
css/src/components/system-status-counter.css: {}
css/src/components/tabs.css: {}
css/src/components/views-ui.css: {}
theme:
css/src/theme/colors.css: {}
layout:
css/src/layout/breadcrumb.css: {}
css/src/layout/local-actions.css: {}
css/src/layout/layout.css: {}
dependencies:
- system/admin
- core/jquery