public function FeaturesAssigner::loadBundle in Features 8.3
Same name and namespace in other branches
- 8.4 src/FeaturesAssigner.php \Drupal\features\FeaturesAssigner::loadBundle()
Loads a named bundle.
Parameters
string $machine_name: (optional) The name of a features bundle. Defaults to NULL, gets the last bundle from the session.
Return value
\Drupal\features\FeaturesBundleInterface A features bundle object.
Overrides FeaturesAssignerInterface::loadBundle
1 call to FeaturesAssigner::loadBundle()
- FeaturesAssigner::applyBundle in src/
FeaturesAssigner.php - Makes the named bundle the current bundle.
File
- src/
FeaturesAssigner.php, line 430
Class
- FeaturesAssigner
- Class responsible for performing package assignment.
Namespace
Drupal\featuresCode
public function loadBundle($machine_name = NULL) {
if (!isset($machine_name)) {
$session = \Drupal::request()
->getSession();
if (isset($session)) {
$machine_name = isset($session) ? $session
->get('features_current_bundle', FeaturesBundleInterface::DEFAULT_BUNDLE) : FeaturesBundleInterface::DEFAULT_BUNDLE;
}
}
$bundle = $this
->getBundle($machine_name);
if (!isset($bundle)) {
// If bundle no longer exists then return default.
$bundle = $this->bundles[FeaturesBundleInterface::DEFAULT_BUNDLE];
}
return $this
->setCurrent($bundle);
}