This repository has been archived by the owner on Oct 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add dependency on Configuration Split module; empty Develop configura…
…tion split
- Loading branch information
Showing
7 changed files
with
91 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
langcode: en | ||
status: true | ||
dependencies: { } | ||
id: develop | ||
label: Develop | ||
folder: ../config/develop | ||
module: { } | ||
theme: { } | ||
blacklist: { } | ||
graylist: { } | ||
graylist_dependents: true | ||
graylist_skip_equal: true | ||
weight: 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Configuration Split | ||
|
||
[Configuration Split](https://www.drupal.org/project/config_split) module allows to define sets of configuration that will get exported to separate directories when exporting, and get merged together when importing. | ||
|
||
Empty **Develop** configuration split is shipped with this profile. | ||
|
||
## How to | ||
|
||
1. We assume that configuration gets exported into a sub directory of the `config` directory above the web root (e.g. `../config/default`). Develop split will be exported to `../config/develop`. Profile will try to create it upon installation automatically. Export directory can be changed any time. | ||
|
||
1. We do not provide any development configuration. Go to `admin/config/development/configuration/config-split/develop/edit` and edit split settings. [Devel](https://www.drupal.org/project/devel) is a great example of a module which must be blacklisted. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,61 @@ | ||
<?php | ||
|
||
use Drupal\Core\Config\FileStorage; | ||
|
||
/** | ||
* Implements hook_install(). | ||
*/ | ||
function draft_install() { | ||
$config = _draft_read_develop_config_split(); | ||
_draft_prepare_develop_config_split_directory($config); | ||
} | ||
|
||
/** | ||
* Enables Administration links access filter module. | ||
* Installs Administration Links Access Filter module. | ||
*/ | ||
function draft_update_8101(&$sandbox = NULL) { | ||
\Drupal::service('module_installer')->install(['admin_links_access_filter']); | ||
} | ||
|
||
/** | ||
* Installs Configuration Split module and Develop configuration split. | ||
*/ | ||
function draft_update_8102(&$sandbox = NULL) { | ||
if (!Drupal::moduleHandler()->moduleExists('config_split')) { | ||
\Drupal::service('module_installer')->install(['config_split']); | ||
|
||
$config = _draft_read_develop_config_split(); | ||
_draft_prepare_develop_config_split_directory($config); | ||
|
||
/** @var \Drupal\Core\Config\CachedStorage $config_storage */ | ||
$config_storage = \Drupal::service('config.storage'); | ||
$config_storage->write('config_split.config_split.develop', $config); | ||
} | ||
} | ||
|
||
/** | ||
* Reads Develop configuration split configuration data. | ||
* | ||
* @return array | ||
* Develop configuration split configuration data. | ||
*/ | ||
function _draft_read_develop_config_split() { | ||
$config_path = drupal_get_path('profile', 'draft') . '/config/install'; | ||
$source = new FileStorage($config_path); | ||
return $source->read('config_split.config_split.develop'); | ||
} | ||
|
||
/** | ||
* Prepares Develop configuration split export directory. | ||
* | ||
* @param array $config | ||
* Develop configuration split configuration data. | ||
* | ||
* @return bool | ||
* TRUE if Develop configuration split export directory exists and is | ||
* writable, FALSE otherwise. | ||
*/ | ||
function _draft_prepare_develop_config_split_directory(array $config) { | ||
$directory = \Drupal::root() . '/' . $config['folder']; | ||
return file_prepare_directory($directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS); | ||
} |