You are here

public function FeaturesAssigner::setCurrent in Features 8.3

Same name and namespace in other branches
  1. 8.4 src/FeaturesAssigner.php \Drupal\features\FeaturesAssigner::setCurrent()

Sets the currently active bundle.

Updates value in current SESSION.

Parameters

\Drupal\features\FeaturesBundleInterface $bundle: A features bundle object.

Overrides FeaturesAssignerInterface::setCurrent

2 calls to FeaturesAssigner::setCurrent()
FeaturesAssigner::loadBundle in src/FeaturesAssigner.php
Loads a named bundle.
FeaturesAssigner::renameBundle in src/FeaturesAssigner.php
Renames a bundle.

File

src/FeaturesAssigner.php, line 260

Class

FeaturesAssigner
Class responsible for performing package assignment.

Namespace

Drupal\features

Code

public function setCurrent(FeaturesBundleInterface $bundle) {
  $this->currentBundle = $bundle;
  $session = \Drupal::request()
    ->getSession();
  if (isset($session)) {
    $session
      ->set('features_current_bundle', $bundle
      ->getMachineName());
  }
  return $bundle;
}