features.install 864 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. /**
  3. * @file
  4. * Contains install and update functions for Features.
  5. */
  6. /**
  7. * Rebuild the container to add a parameter to the features.manager service.
  8. */
  9. function features_update_8300() {
  10. // Empty update to cause a cache rebuild so that the container is rebuilt.
  11. }
  12. /**
  13. * Update existing feature bundles with new alter plugin configuration.
  14. */
  15. function features_update_8301() {
  16. foreach (\Drupal::service('entity_type.manager')->getStorage('features_bundle')->loadMultiple() as $bundle) {
  17. $bundle = \Drupal::configFactory()->getEditable('features.bundle.' . $bundle->id());
  18. $assignments = $bundle->get('assignments');
  19. $assignments['alter'] = [
  20. 'core' => TRUE,
  21. 'uuid' => TRUE,
  22. 'user_permissions' => TRUE,
  23. 'enabled' => TRUE,
  24. 'weight' => 0,
  25. ];
  26. $bundle->set('assignments', $assignments)->save();
  27. }
  28. }