From 5f362542f07a2d9fa8dda0587348baff2fe0fa6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ph=C3=A9na=20Proxima?= <adam@phenaproxima.net> Date: Tue, 4 Feb 2025 22:23:10 -0500 Subject: [PATCH] Create a distinct and true theme for the installer, which is a million times saner than the alternative --- .../drupal_cms_installer.info.yml | 15 +--------- .../drupal_cms_installer.profile | 26 ++++++++++++++++-- .../css/add-ons.css | 0 .../drupal_cms_installer_theme}/css/fonts.css | 0 .../css/gin-variables.css | 0 .../css/installer-styles.css | 0 .../drupal_cms_installer_theme.info.yml | 10 +++++++ .../drupal_cms_installer_theme.libraries.yml | 13 +++++++++ .../drupal_cms_installer_theme.theme | 15 ++++++++++ .../fonts/inter-cryllic-ext.woff2 | Bin .../fonts/inter-cyrillic.woff2 | Bin .../fonts/inter-greek-ext.woff2 | Bin .../fonts/inter-greek.woff2 | Bin .../fonts/inter-italic-cyrillic-ext.woff2 | Bin .../fonts/inter-italic-cyrillic.woff2 | Bin .../fonts/inter-italic-greek-ext.woff2 | Bin .../fonts/inter-italic-greek.woff2 | Bin .../fonts/inter-italic-latin-ext.woff2 | Bin .../fonts/inter-italic-latin.woff2 | Bin .../fonts/inter-italic-vietnamese.woff2 | Bin .../fonts/inter-latin-ext.woff2 | Bin .../fonts/inter-latin.woff2 | Bin .../fonts/inter-vietnamese.woff2 | Bin .../images/arrow-right.svg | 0 .../images/check-circle.svg | 0 .../images/chevron-down.svg | 0 .../images/drupal-cms-logo.svg | 0 .../images/info.svg | 0 .../images/translate.svg | 0 .../js/progress.js | 0 .../templates/install-page.html.twig | 2 +- 31 files changed, 63 insertions(+), 18 deletions(-) rename project_template/web/profiles/drupal_cms_installer/{ => themes/drupal_cms_installer_theme}/css/add-ons.css (100%) rename project_template/web/profiles/drupal_cms_installer/{ => themes/drupal_cms_installer_theme}/css/fonts.css (100%) rename project_template/web/profiles/drupal_cms_installer/{ => themes/drupal_cms_installer_theme}/css/gin-variables.css (100%) rename project_template/web/profiles/drupal_cms_installer/{ => themes/drupal_cms_installer_theme}/css/installer-styles.css (100%) create mode 100644 project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/drupal_cms_installer_theme.info.yml create mode 100644 project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/drupal_cms_installer_theme.libraries.yml create mode 100644 project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/drupal_cms_installer_theme.theme rename project_template/web/profiles/drupal_cms_installer/{ => themes/drupal_cms_installer_theme}/fonts/inter-cryllic-ext.woff2 (100%) rename project_template/web/profiles/drupal_cms_installer/{ => themes/drupal_cms_installer_theme}/fonts/inter-cyrillic.woff2 (100%) rename project_template/web/profiles/drupal_cms_installer/{ => themes/drupal_cms_installer_theme}/fonts/inter-greek-ext.woff2 (100%) rename project_template/web/profiles/drupal_cms_installer/{ => themes/drupal_cms_installer_theme}/fonts/inter-greek.woff2 (100%) rename project_template/web/profiles/drupal_cms_installer/{ => themes/drupal_cms_installer_theme}/fonts/inter-italic-cyrillic-ext.woff2 (100%) rename project_template/web/profiles/drupal_cms_installer/{ => themes/drupal_cms_installer_theme}/fonts/inter-italic-cyrillic.woff2 (100%) rename project_template/web/profiles/drupal_cms_installer/{ => themes/drupal_cms_installer_theme}/fonts/inter-italic-greek-ext.woff2 (100%) rename project_template/web/profiles/drupal_cms_installer/{ => themes/drupal_cms_installer_theme}/fonts/inter-italic-greek.woff2 (100%) rename project_template/web/profiles/drupal_cms_installer/{ => themes/drupal_cms_installer_theme}/fonts/inter-italic-latin-ext.woff2 (100%) rename project_template/web/profiles/drupal_cms_installer/{ => themes/drupal_cms_installer_theme}/fonts/inter-italic-latin.woff2 (100%) rename project_template/web/profiles/drupal_cms_installer/{ => themes/drupal_cms_installer_theme}/fonts/inter-italic-vietnamese.woff2 (100%) rename project_template/web/profiles/drupal_cms_installer/{ => themes/drupal_cms_installer_theme}/fonts/inter-latin-ext.woff2 (100%) rename project_template/web/profiles/drupal_cms_installer/{ => themes/drupal_cms_installer_theme}/fonts/inter-latin.woff2 (100%) rename project_template/web/profiles/drupal_cms_installer/{ => themes/drupal_cms_installer_theme}/fonts/inter-vietnamese.woff2 (100%) rename project_template/web/profiles/drupal_cms_installer/{ => themes/drupal_cms_installer_theme}/images/arrow-right.svg (100%) rename project_template/web/profiles/drupal_cms_installer/{ => themes/drupal_cms_installer_theme}/images/check-circle.svg (100%) rename project_template/web/profiles/drupal_cms_installer/{ => themes/drupal_cms_installer_theme}/images/chevron-down.svg (100%) rename project_template/web/profiles/drupal_cms_installer/{ => themes/drupal_cms_installer_theme}/images/drupal-cms-logo.svg (100%) rename project_template/web/profiles/drupal_cms_installer/{ => themes/drupal_cms_installer_theme}/images/info.svg (100%) rename project_template/web/profiles/drupal_cms_installer/{ => themes/drupal_cms_installer_theme}/images/translate.svg (100%) rename project_template/web/profiles/drupal_cms_installer/{ => themes/drupal_cms_installer_theme}/js/progress.js (100%) rename project_template/web/profiles/drupal_cms_installer/{ => themes/drupal_cms_installer_theme}/templates/install-page.html.twig (90%) diff --git a/project_template/web/profiles/drupal_cms_installer/drupal_cms_installer.info.yml b/project_template/web/profiles/drupal_cms_installer/drupal_cms_installer.info.yml index 0345ef8eb..5ed1b6fc4 100644 --- a/project_template/web/profiles/drupal_cms_installer/drupal_cms_installer.info.yml +++ b/project_template/web/profiles/drupal_cms_installer/drupal_cms_installer.info.yml @@ -8,6 +8,7 @@ distribution: name: Drupal CMS install: finish_url: '/admin/dashboard/welcome' + theme: drupal_cms_installer_theme forms: - '\Drupal\RecipeKit\Installer\Form\RecipesForm' @@ -24,20 +25,6 @@ recipes: drupal/drupal_cms_person: Person Profiles drupal/drupal_cms_project: Projects -libraries-add: - claro/maintenance-page: - css: - theme: - css/gin-variables.css: {} - css/fonts.css: {} - css/installer-styles.css: {} - css/add-ons.css: {} - dependencies: - - core/once - core/drupal.progress: - js: - js/progress.js: {} - # Explicitly provide an empty list of themes -- this prevents the installer from # injecting Stark into it. # @see install_profile_info() diff --git a/project_template/web/profiles/drupal_cms_installer/drupal_cms_installer.profile b/project_template/web/profiles/drupal_cms_installer/drupal_cms_installer.profile index 586dc1108..fd89bd643 100644 --- a/project_template/web/profiles/drupal_cms_installer/drupal_cms_installer.profile +++ b/project_template/web/profiles/drupal_cms_installer/drupal_cms_installer.profile @@ -2,6 +2,7 @@ declare(strict_types=1); +use Drupal\Core\Extension\ModuleInstallerInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\RecipeKit\Installer\Hooks; use Drupal\RecipeKit\Installer\Messenger; @@ -119,6 +120,7 @@ function drupal_cms_installer_form_install_configure_form_alter(array &$form): v } /** +<<<<<<< Updated upstream * Implements hook_library_info_alter(). */ function drupal_cms_installer_library_info_alter(array &$libraries, string $extension): void { @@ -133,8 +135,26 @@ function drupal_cms_installer_theme_registry_alter(array &$hooks): void { } /** - * Preprocess function for all theme hooks. + * Uninstalls this install profile, as a final step. + * + * @see drupal_install_system() */ -function drupal_cms_installer_preprocess(array &$variables): void { - Hooks::preprocess($variables); +function drupal_cms_installer_uninstall_myself(): void { + \Drupal::service(ModuleInstallerInterface::class)->uninstall([ + 'drupal_cms_installer', + ]); + + // The install is done, so we don't need the list of applied recipes anymore. + \Drupal::state()->delete(RecipeAppliedSubscriber::STATE_KEY); + + // Clear all previous status messages to avoid clutter. + \Drupal::messenger()->deleteByType(MessengerInterface::TYPE_STATUS); + + // Invalidate the container in case any stray requests were made during the + // install process, which would have bootstrapped Drupal and cached the + // install-time container, which is now stale (during the installer, the + // container cannot be dumped, which would normally happen during the + // container rebuild triggered by uninstalling this profile). We do not want + // to redirect into Drupal with a stale container. + \Drupal::service('kernel')->invalidateContainer(); } diff --git a/project_template/web/profiles/drupal_cms_installer/css/add-ons.css b/project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/css/add-ons.css similarity index 100% rename from project_template/web/profiles/drupal_cms_installer/css/add-ons.css rename to project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/css/add-ons.css diff --git a/project_template/web/profiles/drupal_cms_installer/css/fonts.css b/project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/css/fonts.css similarity index 100% rename from project_template/web/profiles/drupal_cms_installer/css/fonts.css rename to project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/css/fonts.css diff --git a/project_template/web/profiles/drupal_cms_installer/css/gin-variables.css b/project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/css/gin-variables.css similarity index 100% rename from project_template/web/profiles/drupal_cms_installer/css/gin-variables.css rename to project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/css/gin-variables.css diff --git a/project_template/web/profiles/drupal_cms_installer/css/installer-styles.css b/project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/css/installer-styles.css similarity index 100% rename from project_template/web/profiles/drupal_cms_installer/css/installer-styles.css rename to project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/css/installer-styles.css diff --git a/project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/drupal_cms_installer_theme.info.yml b/project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/drupal_cms_installer_theme.info.yml new file mode 100644 index 000000000..e5f16c76f --- /dev/null +++ b/project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/drupal_cms_installer_theme.info.yml @@ -0,0 +1,10 @@ +name: Drupal CMS Installer Theme +type: theme +core_version_requirement: '>=10.3' +description: 'Themes the Drupal CMS installer. Not to be used in production.' +base theme: claro +libraries-extend: + claro/maintenance-page: + - drupal_cms_installer_theme/maintenance-page + core/drupal.progress: + - drupal_cms_installer_theme/drupal.progress diff --git a/project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/drupal_cms_installer_theme.libraries.yml b/project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/drupal_cms_installer_theme.libraries.yml new file mode 100644 index 000000000..04fd5c3e3 --- /dev/null +++ b/project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/drupal_cms_installer_theme.libraries.yml @@ -0,0 +1,13 @@ +maintenance-page: + css: + theme: + css/gin-variables.css: {} + css/fonts.css: {} + css/installer-styles.css: {} + css/add-ons.css: {} + dependencies: + - core/once + +drupal.progress: + js: + js/progress.js: {} diff --git a/project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/drupal_cms_installer_theme.theme b/project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/drupal_cms_installer_theme.theme new file mode 100644 index 000000000..197964354 --- /dev/null +++ b/project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/drupal_cms_installer_theme.theme @@ -0,0 +1,15 @@ +<?php + +declare(strict_types=1); + +use Drupal\Core\File\FileUrlGeneratorInterface; + +function drupal_cms_installer_theme_preprocess(array &$variables): void { + // Don't show the version of Drupal. + unset($variables['site_version']); + + $images_path = \Drupal::theme()->getActiveTheme()->getPath() . '/images'; + $images_path = \Drupal::service(FileUrlGeneratorInterface::class) + ->generateString($images_path); + $variables['images_path'] = $images_path; +} diff --git a/project_template/web/profiles/drupal_cms_installer/fonts/inter-cryllic-ext.woff2 b/project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/fonts/inter-cryllic-ext.woff2 similarity index 100% rename from project_template/web/profiles/drupal_cms_installer/fonts/inter-cryllic-ext.woff2 rename to project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/fonts/inter-cryllic-ext.woff2 diff --git a/project_template/web/profiles/drupal_cms_installer/fonts/inter-cyrillic.woff2 b/project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/fonts/inter-cyrillic.woff2 similarity index 100% rename from project_template/web/profiles/drupal_cms_installer/fonts/inter-cyrillic.woff2 rename to project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/fonts/inter-cyrillic.woff2 diff --git a/project_template/web/profiles/drupal_cms_installer/fonts/inter-greek-ext.woff2 b/project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/fonts/inter-greek-ext.woff2 similarity index 100% rename from project_template/web/profiles/drupal_cms_installer/fonts/inter-greek-ext.woff2 rename to project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/fonts/inter-greek-ext.woff2 diff --git a/project_template/web/profiles/drupal_cms_installer/fonts/inter-greek.woff2 b/project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/fonts/inter-greek.woff2 similarity index 100% rename from project_template/web/profiles/drupal_cms_installer/fonts/inter-greek.woff2 rename to project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/fonts/inter-greek.woff2 diff --git a/project_template/web/profiles/drupal_cms_installer/fonts/inter-italic-cyrillic-ext.woff2 b/project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/fonts/inter-italic-cyrillic-ext.woff2 similarity index 100% rename from project_template/web/profiles/drupal_cms_installer/fonts/inter-italic-cyrillic-ext.woff2 rename to project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/fonts/inter-italic-cyrillic-ext.woff2 diff --git a/project_template/web/profiles/drupal_cms_installer/fonts/inter-italic-cyrillic.woff2 b/project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/fonts/inter-italic-cyrillic.woff2 similarity index 100% rename from project_template/web/profiles/drupal_cms_installer/fonts/inter-italic-cyrillic.woff2 rename to project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/fonts/inter-italic-cyrillic.woff2 diff --git a/project_template/web/profiles/drupal_cms_installer/fonts/inter-italic-greek-ext.woff2 b/project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/fonts/inter-italic-greek-ext.woff2 similarity index 100% rename from project_template/web/profiles/drupal_cms_installer/fonts/inter-italic-greek-ext.woff2 rename to project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/fonts/inter-italic-greek-ext.woff2 diff --git a/project_template/web/profiles/drupal_cms_installer/fonts/inter-italic-greek.woff2 b/project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/fonts/inter-italic-greek.woff2 similarity index 100% rename from project_template/web/profiles/drupal_cms_installer/fonts/inter-italic-greek.woff2 rename to project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/fonts/inter-italic-greek.woff2 diff --git a/project_template/web/profiles/drupal_cms_installer/fonts/inter-italic-latin-ext.woff2 b/project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/fonts/inter-italic-latin-ext.woff2 similarity index 100% rename from project_template/web/profiles/drupal_cms_installer/fonts/inter-italic-latin-ext.woff2 rename to project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/fonts/inter-italic-latin-ext.woff2 diff --git a/project_template/web/profiles/drupal_cms_installer/fonts/inter-italic-latin.woff2 b/project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/fonts/inter-italic-latin.woff2 similarity index 100% rename from project_template/web/profiles/drupal_cms_installer/fonts/inter-italic-latin.woff2 rename to project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/fonts/inter-italic-latin.woff2 diff --git a/project_template/web/profiles/drupal_cms_installer/fonts/inter-italic-vietnamese.woff2 b/project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/fonts/inter-italic-vietnamese.woff2 similarity index 100% rename from project_template/web/profiles/drupal_cms_installer/fonts/inter-italic-vietnamese.woff2 rename to project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/fonts/inter-italic-vietnamese.woff2 diff --git a/project_template/web/profiles/drupal_cms_installer/fonts/inter-latin-ext.woff2 b/project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/fonts/inter-latin-ext.woff2 similarity index 100% rename from project_template/web/profiles/drupal_cms_installer/fonts/inter-latin-ext.woff2 rename to project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/fonts/inter-latin-ext.woff2 diff --git a/project_template/web/profiles/drupal_cms_installer/fonts/inter-latin.woff2 b/project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/fonts/inter-latin.woff2 similarity index 100% rename from project_template/web/profiles/drupal_cms_installer/fonts/inter-latin.woff2 rename to project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/fonts/inter-latin.woff2 diff --git a/project_template/web/profiles/drupal_cms_installer/fonts/inter-vietnamese.woff2 b/project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/fonts/inter-vietnamese.woff2 similarity index 100% rename from project_template/web/profiles/drupal_cms_installer/fonts/inter-vietnamese.woff2 rename to project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/fonts/inter-vietnamese.woff2 diff --git a/project_template/web/profiles/drupal_cms_installer/images/arrow-right.svg b/project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/images/arrow-right.svg similarity index 100% rename from project_template/web/profiles/drupal_cms_installer/images/arrow-right.svg rename to project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/images/arrow-right.svg diff --git a/project_template/web/profiles/drupal_cms_installer/images/check-circle.svg b/project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/images/check-circle.svg similarity index 100% rename from project_template/web/profiles/drupal_cms_installer/images/check-circle.svg rename to project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/images/check-circle.svg diff --git a/project_template/web/profiles/drupal_cms_installer/images/chevron-down.svg b/project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/images/chevron-down.svg similarity index 100% rename from project_template/web/profiles/drupal_cms_installer/images/chevron-down.svg rename to project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/images/chevron-down.svg diff --git a/project_template/web/profiles/drupal_cms_installer/images/drupal-cms-logo.svg b/project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/images/drupal-cms-logo.svg similarity index 100% rename from project_template/web/profiles/drupal_cms_installer/images/drupal-cms-logo.svg rename to project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/images/drupal-cms-logo.svg diff --git a/project_template/web/profiles/drupal_cms_installer/images/info.svg b/project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/images/info.svg similarity index 100% rename from project_template/web/profiles/drupal_cms_installer/images/info.svg rename to project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/images/info.svg diff --git a/project_template/web/profiles/drupal_cms_installer/images/translate.svg b/project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/images/translate.svg similarity index 100% rename from project_template/web/profiles/drupal_cms_installer/images/translate.svg rename to project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/images/translate.svg diff --git a/project_template/web/profiles/drupal_cms_installer/js/progress.js b/project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/js/progress.js similarity index 100% rename from project_template/web/profiles/drupal_cms_installer/js/progress.js rename to project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/js/progress.js diff --git a/project_template/web/profiles/drupal_cms_installer/templates/install-page.html.twig b/project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/templates/install-page.html.twig similarity index 90% rename from project_template/web/profiles/drupal_cms_installer/templates/install-page.html.twig rename to project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/templates/install-page.html.twig index eea39d1a7..073afab49 100644 --- a/project_template/web/profiles/drupal_cms_installer/templates/install-page.html.twig +++ b/project_template/web/profiles/drupal_cms_installer/themes/drupal_cms_installer_theme/templates/install-page.html.twig @@ -12,7 +12,7 @@ <div class="cms-installer"> <header class="cms-installer__header"> <h1 class="cms-installer__heading"> - <img src="{{ profile_path }}/images/drupal-cms-logo.svg" alt="{{ 'Drupal CMS'|t }}" /> + <img src="{{ images_path }}/drupal-cms-logo.svg" alt="{{ 'Drupal CMS'|t }}" /> </h1> </header> <div class="cms-installer__wrapper"> -- GitLab