FeaturesAssignmentOptionalType.php 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace Drupal\features\Plugin\FeaturesAssignment;
  3. use Drupal\Core\Config\InstallStorage;
  4. use Drupal\features\FeaturesAssignmentMethodBase;
  5. /**
  6. * Class for assigning configuration to the
  7. * InstallStorage::CONFIG_OPTIONAL_DIRECTORY based on entity types.
  8. *
  9. * @Plugin(
  10. * id = "optional",
  11. * weight = 0,
  12. * name = @Translation("Optional type"),
  13. * description = @Translation("Assign designated types of configuration to the 'config/optional' install directory. For example, if views are selected as optional, views assigned to any feature will be exported to the 'config/optional' directory and will not create a dependency on the Views module."),
  14. * config_route_name = "features.assignment_optional",
  15. * default_settings = {
  16. * "types" = {
  17. * "config" = {},
  18. * }
  19. * }
  20. * )
  21. */
  22. class FeaturesAssignmentOptionalType extends FeaturesAssignmentMethodBase {
  23. /**
  24. * {@inheritdoc}
  25. */
  26. public function assignPackages($force = FALSE) {
  27. $this->assignSubdirectoryByConfigTypes(InstallStorage::CONFIG_OPTIONAL_DIRECTORY);
  28. }
  29. }