You are here

function features_update_8301 in Features 8.4

Same name and namespace in other branches
  1. 8.3 features.install \features_update_8301()

Update existing feature bundles with new alter plugin configuration.

File

./features.install, line 18
Contains install and update functions for Features.

Code

function features_update_8301() {
  foreach (\Drupal::service('entity_type.manager')
    ->getStorage('features_bundle')
    ->loadMultiple() as $bundle) {
    $bundle = \Drupal::configFactory()
      ->getEditable('features.bundle.' . $bundle
      ->id());
    $assignments = $bundle
      ->get('assignments');
    $assignments['alter'] = [
      'core' => TRUE,
      'uuid' => TRUE,
      'user_permissions' => TRUE,
      'enabled' => TRUE,
      'weight' => 0,
    ];
    $bundle
      ->set('assignments', $assignments)
      ->save();
  }
}