You are here

public function FeaturesAssigner::findBundle in Features 8.3

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

Searches for a bundle that matches the $info.yml or $features.yml export.

Creates a new bundle as needed.

Parameters

array $info: The bundle info.

mixed $features_info: The features info.

Return value

\Drupal\features\FeaturesBundleInterface A bundle.

Overrides FeaturesAssignerInterface::findBundle

File

src/FeaturesAssigner.php, line 242

Class

FeaturesAssigner
Class responsible for performing package assignment.

Namespace

Drupal\features

Code

public function findBundle(array $info, $features_info = NULL) {
  $bundle = NULL;
  if (!empty($features_info['bundle'])) {
    $bundle = $this
      ->getBundle($features_info['bundle']);
  }
  elseif (!empty($info['package'])) {
    $bundle = $this
      ->findBundleByName($info['package']);
  }
  if (!isset($bundle)) {

    // Return the default bundle.
    return $this
      ->getBundle(FeaturesBundleInterface::DEFAULT_BUNDLE);
  }
  return $bundle;
}