diff --git a/CRM/Upgrade/Incremental/php/SixOne.php b/CRM/Upgrade/Incremental/php/SixOne.php
index 2d302894495d..52015adfb9e6 100644
--- a/CRM/Upgrade/Incremental/php/SixOne.php
+++ b/CRM/Upgrade/Incremental/php/SixOne.php
@@ -31,6 +31,30 @@ public function upgrade_6_1_alpha1($rev): void {
$this->addTask(ts('Upgrade DB to %1: SQL', [1 => $rev]), 'runSql', $rev);
$this->addTask('Replace Clear Caches & Reset Paths with Clear Caches in Nav Menu', 'updateUpdateConfigBackendNavItem');
+
+ $this->addExtensionTask('Enable Riverlea extension', ['riverlea']);
+ $this->addTask('Freeze "default" theme to Greenwich', 'freezeDefaultThemeToGreenwich');
+ }
+
+ /**
+ * 'default' is being removed as a valid theme choice.
+ *
+ * It has always meant Greenwich, so sites previously on
+ * "default" change this to an explicit value Greenwich.
+ *
+ * @return bool
+ */
+ public static function freezeDefaultThemeToGreenwich() {
+ $themeSettings = ['theme_backend', 'theme_frontend'];
+
+ foreach ($themeSettings as $key) {
+ $value = \Civi::settings()->get($key);
+ if ($value === 'default') {
+ \Civi::settings()->set($key, 'greenwich');
+ }
+ }
+
+ return TRUE;
}
/**
diff --git a/Civi/Core/Themes.php b/Civi/Core/Themes.php
index 05469ba93710..ea681c887e54 100644
--- a/Civi/Core/Themes.php
+++ b/Civi/Core/Themes.php
@@ -22,10 +22,14 @@
class Themes extends \Civi\Core\Service\AutoService {
/**
- * The "default" theme adapts based on the latest recommendation from civicrm.org
- * by switching to DEFAULT_THEME at runtime.
+ * Disable core CSS.
*/
- const DEFAULT_THEME = 'greenwich';
+ const NO_STYLES = 'none';
+
+ /**
+ * Core CSS only.
+ */
+ const NO_THEME = 'no_theme';
/**
* Fallback is a pseudotheme which can be included in "search_order".
@@ -68,13 +72,18 @@ public function __construct($cache = NULL) {
*/
public function getActiveThemeKey() {
if ($this->activeThemeKey === NULL) {
- // Ambivalent: is it better to use $config->userFrameworkFrontend or $template->get('urlIsPublic')?
- $config = \CRM_Core_Config::singleton();
- $settingKey = $config->userSystem->isFrontEndPage() ? 'theme_frontend' : 'theme_backend';
+ $settingKey = \CRM_Utils_System::isFrontEndPage() ? 'theme_frontend' : 'theme_backend';
$themeKey = Civi::settings()->get($settingKey);
+
+ // catch for if 'default' value has stuck around. for as long as anyone
+ // can remember default meant Greenwich
+ // TODO: remove this catch around 6.12?
if ($themeKey === 'default') {
- $themeKey = self::DEFAULT_THEME;
+ \Civi::log()->debug("Warning: found deprecated value 'default' for '{$settingKey}'. This will be interpreted as Greenwich but this handling may be removed in a future release.");
+ // fix it for you?
+ // Civi::settings()->set($settingKey, 'greenwich');
+ $themeKey = 'greenwich';
}
\CRM_Utils_Hook::activeTheme($themeKey, [
@@ -83,7 +92,7 @@ public function getActiveThemeKey() {
]);
$themes = $this->getAll();
- $this->activeThemeKey = isset($themes[$themeKey]) ? $themeKey : self::DEFAULT_THEME;
+ $this->activeThemeKey = isset($themes[$themeKey]) ? $themeKey : self::NO_THEME;
}
return $this->activeThemeKey;
}
@@ -196,27 +205,21 @@ public function resolveUrls($active, $cssExt, $cssFile) {
*/
protected function buildAll() {
$themes = [
- 'default' => [
- 'ext' => 'civicrm',
- 'title' => ts('Automatic'),
- 'help' => ts('Determine a system default automatically'),
- // This is an alias. url_callback, search_order don't matter.
- ],
- 'greenwich' => [
- 'ext' => 'civicrm',
- 'title' => 'Greenwich',
- 'help' => ts('CiviCRM 4.x look-and-feel'),
- ],
- 'none' => [
+ self::NO_STYLES => [
'ext' => 'civicrm',
- 'title' => ts('None (Unstyled)'),
+ 'title' => ts('No Styles'),
'help' => ts('Disable CiviCRM\'s built-in CSS files.'),
- 'search_order' => ['none', self::FALLBACK_THEME],
+ 'search_order' => [self::NO_STYLES, self::FALLBACK_THEME],
'excludes' => [
"css/civicrm.css",
"css/bootstrap.css",
],
],
+ self::NO_THEME => [
+ 'ext' => 'civicrm',
+ 'title' => ts('No Theme'),
+ 'search_order' => [self::NO_THEME, self::FALLBACK_THEME],
+ ],
self::FALLBACK_THEME => [
'ext' => 'civicrm',
'title' => 'Fallback (Abstract Base Theme)',
diff --git a/ext/greenwich/info.xml b/ext/greenwich/info.xml
index 09b82eff3095..9bbea1b9b746 100644
--- a/ext/greenwich/info.xml
+++ b/ext/greenwich/info.xml
@@ -16,9 +16,6 @@
[civicrm.releaseDate]
[civicrm.version]
-
- mgmt:hidden
-
stable
[civicrm.majorVersion]
diff --git a/settings/Core.setting.php b/settings/Core.setting.php
index d604f723877d..cdcc96eee877 100644
--- a/settings/Core.setting.php
+++ b/settings/Core.setting.php
@@ -1184,7 +1184,7 @@
'pseudoconstant' => array(
'callback' => 'call://themes/getAvailable',
),
- 'default' => 'default',
+ 'default' => 'no_theme',
'add' => '5.16',
'title' => ts('Frontend Theme'),
'is_domain' => 1,
@@ -1209,7 +1209,7 @@
'pseudoconstant' => array(
'callback' => 'call://themes/getAvailable',
),
- 'default' => 'default',
+ 'default' => 'no_theme',
'add' => '5.16',
'title' => ts('Backend Theme'),
'is_domain' => 1,
diff --git a/tests/phpunit/Civi/Core/ThemesTest.php b/tests/phpunit/Civi/Core/ThemesTest.php
index 3bbf8d31d2e6..aeda75526445 100644
--- a/tests/phpunit/Civi/Core/ThemesTest.php
+++ b/tests/phpunit/Civi/Core/ThemesTest.php
@@ -54,10 +54,23 @@ public function getThemeExamples() {
// --- Library of tests ---
- // Use the default theme, Greenwich.
+ // Use Minetta from Riverlea
+ // TODO: why is Greenwich enabled here, but Riverlea is not?
+ // $cases[] = [
+ // [],
+ // 'minetta',
+ // 'Minetta (RiverLea ~Greenwich)',
+ // [
+ // 'civicrm-css/civicrm.css' => ["$civicrmBaseUrl/ext/riverlea/core/css/civicrm.css"],
+ // 'civicrm-css/joomla.css' => ["$civicrmBaseUrl/ext/riverlea/core/css/joomla.css"],
+ // 'test.extension.uitest-files/foo.css' => ["$civicrmBaseUrl/tests/extensions/test.extension.uitest/files/foo.css"],
+ // ],
+ // ];
+
+ // Use Greenwich
$cases[] = [
[],
- 'default',
+ 'greenwich',
'Greenwich',
[
'civicrm-css/civicrm.css' => ["$civicrmBaseUrl/css/civicrm.css"],
@@ -82,11 +95,11 @@ public function getThemeExamples() {
],
];
- // Misconfiguration: liza was previously used but then disappeared. Fallback to default, Greenwich.
+ // Misconfiguration: liza was previously used but then disappeared. Fallback to default, NO_THEME.
$cases[] = [
$hookJudy,
'liza',
- 'Greenwich',
+ 'No Theme',
[
'civicrm-css/civicrm.css' => ["$civicrmBaseUrl/css/civicrm.css"],
'civicrm-css/joomla.css' => ["$civicrmBaseUrl/css/joomla.css"],
@@ -98,7 +111,7 @@ public function getThemeExamples() {
$cases[] = [
$hookJudy,
'none',
- 'None (Unstyled)',
+ 'No Styles',
[
'civicrm-css/civicrm.css' => [],
'civicrm-css/joomla.css' => ["$civicrmBaseUrl/css/joomla.css"],
@@ -195,15 +208,20 @@ public static function fakeCallback($themes, $themeKey, $cssExt, $cssFile) {
return $map[$themeKey][$cssExt][$cssFile] ?? Themes::PASSTHRU;
}
+ /**
+ * TODO with all these: why do we have greenwich not minetta here?
+ */
public function testGetAll(): void {
$all = \Civi::service('themes')->getAll();
$this->assertTrue(isset($all['greenwich']));
+ // $this->assertTrue(isset($all['minetta']));
$this->assertTrue(isset($all['_fallback_']));
}
public function testGetAvailable(): void {
$all = \Civi::service('themes')->getAvailable();
$this->assertTrue(isset($all['greenwich']));
+ // $this->assertTrue(isset($all['minetta']));
$this->assertFalse(isset($all['_fallback_']));
}
@@ -212,6 +230,7 @@ public function testApiOptions(): void {
'field' => 'theme_backend',
]);
$this->assertTrue(isset($result['values']['greenwich']));
+ // $this->assertTrue(isset($result['values']['minetta']));
$this->assertFalse(isset($result['values']['_fallback_']));
}