Skip to content

Instantly share code, notes, and snippets.

@podarok
Last active July 7, 2021 12:13
Show Gist options
  • Save podarok/3c14521da12ad73fa08fe3ec0a237a28 to your computer and use it in GitHub Desktop.
Save podarok/3c14521da12ad73fa08fe3ec0a237a28 to your computer and use it in GitHub Desktop.
features_hook.diff
diff --git a/features.module b/features.module
index 07e2740..7d061b2 100644
--- a/features.module
+++ b/features.module
@@ -48,10 +48,12 @@ function features_file_download($uri) {
/**
* Implements hook_modules_installed().
*/
-function features_modules_installed($modules) {
- if (!in_array('features', $modules)) {
- /** @var \Drupal\features\FeaturesAssignerInterface $assigner */
- $assigner = \Drupal::service('features_assigner');
- $assigner->purgeConfiguration();
+function features_modules_installed($modules, $is_syncing) {
+ if (!$is_syncing && !in_array('features', $modules)) {
+ if (!empty(\Drupal::hasService('features_assigner'))) {
+ /** @var \Drupal\features\FeaturesAssignerInterface $assigner */
+ $assigner = \Drupal::service('features_assigner');
+ $assigner->purgeConfiguration();
+ }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment