Commit 72b36e00 authored by Nedjo Rogers's avatar Nedjo Rogers Committed by Nedjo Rogers
Browse files

Issue #2569149 by nedjo: Copy over assignment settings from default bundle rather than cloning

parent 731b97fd
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -282,8 +282,11 @@ class FeaturesAssigner implements FeaturesAssignerInterface {
   * {@inheritdoc}
   */
  public function createBundleFromDefault($machine_name, $name = NULL, $description = NULL, $is_profile = FALSE, $profile_name = NULL) {
    // Clone the default bundle to get its default configuration.
    $bundle = clone $this->getBundle(FeaturesBundleInterface::DEFAULT_BUNDLE);
    $bundle = FeaturesBundle::create([]);

    // Initialize assignment settings from those of the default bundle.
    $default_bundle = $this->getBundle(FeaturesBundleInterface::DEFAULT_BUNDLE);
    $bundle->setAssignmentSettings(NULL, $default_bundle->getAssignmentSettings(NULL));

    $bundle->setMachineName($machine_name);
    $bundle->setName($name);
@@ -299,6 +302,7 @@ class FeaturesAssigner implements FeaturesAssignerInterface {
    }
    $bundle->save();
    $this->setBundle($bundle);

    return $bundle;
  }

+1 −1
Original line number Diff line number Diff line
@@ -149,7 +149,7 @@ interface FeaturesAssignerInterface {
  public function findBundleByName($name);

  /**
   * Creates a new bundle by cloning the default bundle and customizing.
   * Creates a new bundle, copying over default assignment settings.
   *
   * @param string $machine_name
   *   Machine name.