+
+ // Get a list of installed profiles that will be excluded when calculating
+ // the dependency tree.
+ if (\Drupal::hasService('profile_handler')) {
+ // #1356276 adds the profile_handler service but it hasn't been committed
+ // to core yet so we need to check if it exists.
+ $profiles = \Drupal::service('profile_handler')->getProfileInheritance();
+ } else {
+ $profiles[drupal_get_profile()] = [];
+ }
+