mirror of
https://github.com/farmOS/farmOS.git
synced 2024-02-23 11:37:38 +01:00
Install Gin via farm_ui_theme_install() instead of config/install.
This commit is contained in:
parent
453063f64b
commit
99eb69434a
|
@ -1,3 +0,0 @@
|
||||||
allow_insecure_uploads: false
|
|
||||||
default_scheme: private
|
|
||||||
temporary_maximum_age: 21600
|
|
|
@ -1,2 +0,0 @@
|
||||||
admin: ''
|
|
||||||
default: gin
|
|
|
@ -17,4 +17,4 @@ dependencies: { }
|
||||||
install:
|
install:
|
||||||
- dblog
|
- dblog
|
||||||
themes:
|
themes:
|
||||||
- gin
|
- claro
|
||||||
|
|
|
@ -7,6 +7,15 @@
|
||||||
|
|
||||||
use Drupal\Component\Serialization\Json;
|
use Drupal\Component\Serialization\Json;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implements hook_install().
|
||||||
|
*/
|
||||||
|
function farm_install() {
|
||||||
|
|
||||||
|
// Use private file system by default.
|
||||||
|
\Drupal::configFactory()->getEditable('system.file')->set('default_scheme', 'private')->save();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements hook_install_tasks().
|
* Implements hook_install_tasks().
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
langcode: en
|
|
||||||
status: true
|
|
||||||
dependencies:
|
|
||||||
module:
|
|
||||||
- farm_ui_theme
|
|
||||||
theme:
|
|
||||||
- claro
|
|
||||||
id: farm_powered
|
|
||||||
theme: claro
|
|
||||||
region: content
|
|
||||||
weight: 1000
|
|
||||||
provider: null
|
|
||||||
plugin: farm_powered_by_block
|
|
||||||
settings:
|
|
||||||
id: farm_powered_by_block
|
|
||||||
label: 'Powered by farmOS'
|
|
||||||
provider: farm_ui_theme
|
|
||||||
label_display: '0'
|
|
||||||
visibility: { }
|
|
|
@ -1,8 +0,0 @@
|
||||||
classic_toolbar: vertical
|
|
||||||
preset_accent_color: green
|
|
||||||
preset_focus_color: orange
|
|
||||||
icon_default: false
|
|
||||||
icon_path: 'profiles/farm/modules/ui/theme/logo.png'
|
|
||||||
favicon:
|
|
||||||
use_default: false
|
|
||||||
path: 'profiles/farm/modules/ui/theme/favicon.ico'
|
|
|
@ -1,8 +1,7 @@
|
||||||
name: farmOS UI Theme
|
name: farmOS UI Theme
|
||||||
description: Provides Gin theme overrides for farmOS.
|
description: Install Gin theme and provide overrides for farmOS.
|
||||||
type: module
|
type: module
|
||||||
package: farmOS UI
|
package: farmOS UI
|
||||||
core_version_requirement: ^9
|
core_version_requirement: ^9
|
||||||
dependencies:
|
dependencies:
|
||||||
- config_rewrite:config_rewrite
|
|
||||||
- drupal:block
|
- drupal:block
|
||||||
|
|
63
modules/ui/theme/farm_ui_theme.install
Normal file
63
modules/ui/theme/farm_ui_theme.install
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* Install, update and uninstall functions for the farm_ui_theme module.
|
||||||
|
*/
|
||||||
|
|
||||||
|
use Drupal\block\Entity\Block;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implements hook_install().
|
||||||
|
*/
|
||||||
|
function farm_ui_theme_install() {
|
||||||
|
|
||||||
|
// Install the Gin theme and make it the default.
|
||||||
|
\Drupal::service('theme_installer')->install(['gin']);
|
||||||
|
\Drupal::configFactory()->getEditable('system.theme')->set('default', 'gin')->save();
|
||||||
|
|
||||||
|
// Load Gin settings.
|
||||||
|
$gin_settings = \Drupal::configFactory()->getEditable('gin.settings');
|
||||||
|
|
||||||
|
// Use vertical toolbar.
|
||||||
|
$gin_settings->set('classic_toolbar', 'vertical');
|
||||||
|
|
||||||
|
// Use green/orange color palette.
|
||||||
|
$gin_settings->set('preset_accent_color', 'green');
|
||||||
|
$gin_settings->set('preset_focus_color', 'orange');
|
||||||
|
|
||||||
|
// Use farmOS logo and favicon.
|
||||||
|
$gin_settings->set('icon_default', FALSE);
|
||||||
|
$gin_settings->set('icon_path', drupal_get_path('module', 'farm_ui_theme') . '/logo.png');
|
||||||
|
$gin_settings->set('favicon.use_default', FALSE);
|
||||||
|
$gin_settings->set('favicon.path', drupal_get_path('module', 'farm_ui_theme') . '/favicon.ico');
|
||||||
|
|
||||||
|
// Save Gin settings.
|
||||||
|
$gin_settings->save();
|
||||||
|
|
||||||
|
// Create the "Powered by farmOS" block.
|
||||||
|
// This must be done in hook_install() instead of config/install because Gin
|
||||||
|
// needs to be installed first.
|
||||||
|
$values = [
|
||||||
|
'id' => 'farm_powered',
|
||||||
|
'plugin' => 'farm_powered_by_block',
|
||||||
|
'theme' => 'gin',
|
||||||
|
'region' => 'content',
|
||||||
|
'weight' => 1000,
|
||||||
|
'settings' => [
|
||||||
|
'id' => 'farm_powered_by_block',
|
||||||
|
'label' => t('Powered by farmOS'),
|
||||||
|
'provider' => 'farm_ui_theme',
|
||||||
|
'label_display' => '0',
|
||||||
|
],
|
||||||
|
'visibility' => [],
|
||||||
|
'dependencies' => [
|
||||||
|
'enforced' => [
|
||||||
|
'module' => [
|
||||||
|
'farm_ui_theme',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
Block::create($values)->save();
|
||||||
|
}
|
Loading…
Reference in a new issue