You are here

protected function FeaturesAssigner::getAssignmentMethodInstance in Features 8.3

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

Returns an instance of the specified package assignment method.

Parameters

string $method_id: The string identifier of the package assignment method to use to package configuration.

Return value

\Drupal\features\FeaturesAssignmentMethodInterface The package assignment method instance.

File

src/FeaturesAssigner.php, line 192

Class

FeaturesAssigner
Class responsible for performing package assignment.

Namespace

Drupal\features

Code

protected function getAssignmentMethodInstance($method_id) {
  if (!isset($this->methods[$method_id])) {
    $instance = $this->assignerManager
      ->createInstance($method_id, []);
    $instance
      ->setFeaturesManager($this->featuresManager);
    $instance
      ->setAssigner($this);
    $instance
      ->setEntityTypeManager($this->entityTypeManager);
    $instance
      ->setConfigFactory($this->configFactory);
    $this->methods[$method_id] = $instance;
  }
  return $this->methods[$method_id];
}