Skip to content
Snippets Groups Projects
Commit 5f362542 authored by Adam G-H's avatar Adam G-H
Browse files

Create a distinct and true theme for the installer, which is a million times...

Create a distinct and true theme for the installer, which is a million times saner than the alternative
parent 6355cf55
No related branches found
No related tags found
1 merge request!488Installer kit
Pipeline #415287 failed
Showing
with 62 additions and 17 deletions
......@@ -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()
......
......@@ -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();
}
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
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: {}
<?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;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment