You are here

protected function FeaturesAssignmentMethodBase::assignSubdirectoryByConfigTypes in Features 8.4

Same name and namespace in other branches
  1. 8.3 src/FeaturesAssignmentMethodBase.php \Drupal\features\FeaturesAssignmentMethodBase::assignSubdirectoryByConfigTypes()

Assigns a given subdirectory to configuration of specified types.

Parameters

string $subdirectory: The subdirectory that designated configuration should be exported to.

1 call to FeaturesAssignmentMethodBase::assignSubdirectoryByConfigTypes()
FeaturesAssignmentOptionalType::assignPackages in src/Plugin/FeaturesAssignment/FeaturesAssignmentOptionalType.php
Performs package assignment.

File

src/FeaturesAssignmentMethodBase.php, line 104

Class

FeaturesAssignmentMethodBase
Base class for package assignment methods.

Namespace

Drupal\features

Code

protected function assignSubdirectoryByConfigTypes($subdirectory) {
  $current_bundle = $this->assigner
    ->getBundle();
  $settings = $current_bundle
    ->getAssignmentSettings($this
    ->getPluginId());
  $types = $settings['types']['config'];
  if (!empty($types)) {
    $config_collection = $this->featuresManager
      ->getConfigCollection();
    foreach ($config_collection as &$item) {
      if (in_array($item
        ->getType(), $types)) {
        $item
          ->setSubdirectory($subdirectory);
      }
    }

    // Clean up the $item pass by reference.
    unset($item);
    $this->featuresManager
      ->setConfigCollection($config_collection);
  }
}