Skip to content
This repository has been archived by the owner on Jun 22, 2020. It is now read-only.

Commit

Permalink
Issue #2931007 by chr.fritsch: Thunder installs all optional config a…
Browse files Browse the repository at this point in the history
…fter a module install
  • Loading branch information
chrfritsch authored and dbosen committed Dec 19, 2017
1 parent 679b2f9 commit fae678c
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 6 deletions.
Expand Up @@ -9,5 +9,6 @@ description: ''
type: video_embed_field
queue_thumbnail_downloads: false
new_revision: false
type_configuration: { }
type_configuration:
source_field: field_media_video_embed_field
field_map: { }
Expand Up @@ -5,6 +5,9 @@ dependencies:
- core.entity_view_mode.media.amp
- field.field.media.gallery.field_media_images
- media_entity.bundle.gallery
enforced:
theme:
- thunder_amp
id: media.gallery.amp
targetEntityType: media
bundle: gallery
Expand Down
Expand Up @@ -13,6 +13,11 @@ dependencies:
- media_entity.bundle.image
module:
- amp
enforced:
module:
- amp
theme:
- thunder_amp
id: media.image.amp
targetEntityType: media
bundle: image
Expand Down
Expand Up @@ -14,6 +14,9 @@ dependencies:
module:
- entity_reference_revisions
- user
enforced:
theme:
- thunder_amp
id: node.article.amp
targetEntityType: node
bundle: article
Expand Down
Expand Up @@ -5,6 +5,9 @@ dependencies:
- core.entity_view_mode.paragraph.amp
- field.field.paragraph.gallery.field_media
- paragraphs.paragraphs_type.gallery
enforced:
theme:
- thunder_amp
id: paragraph.gallery.amp
targetEntityType: paragraph
bundle: gallery
Expand Down
Expand Up @@ -5,6 +5,9 @@ dependencies:
- core.entity_view_mode.paragraph.amp
- field.field.paragraph.image.field_image
- paragraphs.paragraphs_type.image
enforced:
theme:
- thunder_amp
id: paragraph.image.amp
targetEntityType: paragraph
bundle: image
Expand Down
Expand Up @@ -5,6 +5,9 @@ dependencies:
- core.entity_view_mode.paragraph.amp
- field.field.paragraph.video.field_video
- paragraphs.paragraphs_type.video
enforced:
theme:
- thunder_amp
id: paragraph.video.amp
targetEntityType: paragraph
bundle: video
Expand Down
Expand Up @@ -3,6 +3,9 @@ status: true
dependencies:
module:
- media_entity
enforced:
theme:
- thunder_amp
id: media.amp
label: AMP
targetEntityType: media
Expand Down
Expand Up @@ -3,6 +3,9 @@ status: true
dependencies:
module:
- paragraphs
enforced:
theme:
- thunder_amp
id: paragraph.amp
label: AMP
targetEntityType: paragraph
Expand Down
15 changes: 10 additions & 5 deletions thunder.profile
Expand Up @@ -147,7 +147,6 @@ function _thunder_install_module_batch($module, $module_name, $form_values, &$co

$instance = $optionalModulesManager->createInstance($module_name);
$instance->submitForm($form_values);
\Drupal::service('config.installer')->installOptionalConfig();
}
catch (\Exception $e) {

Expand All @@ -172,7 +171,6 @@ function thunder_themes_installed($theme_list) {
}

\Drupal::service('module_installer')->install(['infinite_article'], TRUE);
\Drupal::service('config.installer')->installOptionalConfig();

// Ensure that footer block is pre-filled with lazy loading block.
$entityTypeManager = \Drupal::service('entity_type.manager');
Expand Down Expand Up @@ -236,7 +234,6 @@ function thunder_themes_installed($theme_list) {
if (in_array('thunder_amp', $theme_list)) {
// Install AMP module.
\Drupal::service('module_installer')->install(['amp'], TRUE);
\Drupal::service('config.installer')->installOptionalConfig();

\Drupal::configFactory()
->getEditable('amp.settings')
Expand Down Expand Up @@ -272,7 +269,6 @@ function thunder_themes_installed($theme_list) {

if (in_array('amptheme', $theme_list)) {
\Drupal::service('module_installer')->install(['amp'], TRUE);
\Drupal::service('config.installer')->installOptionalConfig();
}
}

Expand Down Expand Up @@ -313,7 +309,16 @@ function thunder_modules_installed($modules) {
$field->save();
}

\Drupal::service('config.installer')->installOptionalConfig();
$configs = Drupal::configFactory()->loadMultiple(\Drupal::configFactory()->listAll());
foreach ($configs as $config) {
$dependencies = $config->get('dependencies.module');
$enforced_dependencies = $config->get('dependencies.enforced.module');
$dependencies = $dependencies ?: [];
$enforced_dependencies = $enforced_dependencies ?: [];
if (array_intersect($modules, $dependencies) || array_intersect($modules, $enforced_dependencies)) {
\Drupal::service('config.installer')->installOptionalConfig(NULL, ['config' => $config->getName()]);
}
}
}

/**
Expand Down

0 comments on commit fae678c

Please sign in to comment.