getProfileName() is 'example', a * directory profiles/example will be scanned if it exists. Therefore, when * regenerating package modules, existing ones from a prior export will be * recognized. * * @param string[] $machine_names * Package machine names to return directories for. If omitted, return all * directories. * @param \Drupal\features\FeaturesBundleInterface $bundle * Optional bundle to use to add profile directories to the scan. * * @return array * Array of package directories keyed by package machine name. */ public function listPackageDirectories(array $machine_names = array(), FeaturesBundleInterface $bundle = NULL); /** * Assigns a set of configuration items to a given package or profile. * * @param string $package_name * Machine name of a package or the profile. * @param string[] $item_names * Configuration item names. * @param bool $force * (optional) If TRUE, assign config regardless of restrictions such as it * being already assigned to a package. * * @throws Exception */ public function assignConfigPackage($package_name, array $item_names, $force = FALSE); /** * Assigns configuration items with names matching given strings to given * packages. * * @param array $patterns * Array with string patterns as keys and package machine names as values. */ public function assignConfigByPattern(array $patterns); /** * For given configuration items, assigns any dependent configuration to the * same package. * * @param string[] $item_names * Configuration item names. * @param string $package * Short machine name of package to assign dependent config to. If NULL, * use the current package of the parent config items. */ public function assignConfigDependents(array $item_names = NULL, $package = NULL); /** * Adds the optional bundle prefix to package machine names. * * @param \Drupal\features\FeaturesBundleInterface $bundle * The bundle used for the generation. * @param string[] &$package_names * (optional) Array of package names, passed by reference. */ public function setPackageBundleNames(FeaturesBundleInterface $bundle, array &$package_names = []); /** * Assigns dependencies from config items into the package. * * @param \Drupal\features\Package[] $packages * An array of packages. NULL for all packages */ public function assignPackageDependencies(Package $package = NULL); /** * Assigns dependencies between packages based on configuration dependencies. * * \Drupal\features\FeaturesBundleInterface::setPackageBundleNames() must be * called prior to calling this method. * * @param \Drupal\features\FeaturesBundleInterface $bundle * A features bundle. * @param \Drupal\features\Package[] $packages * An array of packages. */ public function assignInterPackageDependencies(FeaturesBundleInterface $bundle, array &$packages); /** * Merges two info arrays and processes the resulting array. * * Ensures values are unique and sorted. * * @param array $info1 * The first array. * @param array $info2 * The second array. * @param string[] $keys * Keys to merge. If not specified, all keys present will be merged. * * @return array * An array with the merged and processed results. * * @fixme Should this be moved to the package object or a related helper? */ public function mergeInfoArray(array $info1, array $info2, array $keys = array()); /** * Lists the types of configuration available on the site. * * @param boolean $bundles_only * Whether to list only configuration types that provide bundles. * * @return array * An array with machine name keys and human readable values. */ public function listConfigTypes($bundles_only = FALSE); /** * Lists stored configuration for a given configuration type. * * @param string $config_type * The type of configuration. */ public function listConfigByType($config_type); /** * Returns a list of all modules present on the site's file system. * * @return Drupal\Core\Extension\Extension[] * An array of extension objects. */ public function getAllModules(); /** * Returns a list of Features modules regardless of if they are installed. * * @param \Drupal\features\FeaturesBundleInterface $bundle * Optional bundle to filter module list. * If given, only modules matching the bundle namespace will be returned. * If the bundle uses a profile, only modules in the profile will be * returned. * @param bool $installed * List only installed modules. * * @return Drupal\Core\Extension\Extension[] * An array of extension objects. */ public function getFeaturesModules(FeaturesBundleInterface $bundle = NULL, $installed = FALSE); /** * Lists names of configuration objects provided by a given extension. * * @param \Drupal\Core\Extension\Extension $extension * An Extension object. * * @return array * An array of configuration object names. */ public function listExtensionConfig(Extension $extension); /** * Lists names of configuration items provided by existing Features modules. * * @param bool $installed * List only installed Features. * @param \Drupal\features\FeaturesBundleInterface $bundle * (optional) Bundle to find existing configuration for. * * @return array * An array with config names as keys and providing module names as values. */ public function listExistingConfig($installed = FALSE, FeaturesBundleInterface $bundle = NULL); /** * Iterates through packages and prepares file names and contents. * * @param array $packages * An array of packages. */ public function prepareFiles(array $packages); /** * Returns the full name of a config item. * * @param string $type * The config type, or '' to indicate $name is already prefixed. * @param string $name * The config name, without prefix. * * @return string * The config item's full name. */ public function getFullName($type, $name); /** * Returns the short name and type of a full config name. * * @param string $fullname * The full configuration name * @return array * 'type' => string the config type * 'name_short' => string the short config name, without prefix. */ public function getConfigType($fullname); /** * Returns the full machine name and directory for exporting a package. * * @param \Drupal\features\Package $package * The package. * @param \Drupal\features\FeaturesBundleInterface $bundle * Optional bundle being used for export. * * @return array * An array with the full name as the first item and directory as second * item. */ public function getExportInfo(Package $package, FeaturesBundleInterface $bundle = NULL); /** * Determines if the module is a Features package, optinally testing by * bundle. * * @param \Drupal\Core\Extension\Extension $module * An extension object. * @param \Drupal\features\FeaturesBundleInterface $bundle * (optional) Bundle to filter by. * * @return bool * TRUE if the given module is a Features package of the given bundle (if any). */ public function isFeatureModule(Extension $module, FeaturesBundleInterface $bundle); /** * Determines which config is overridden in a package. * * @param \Drupal\features\Package $feature * The package array. * The 'state' property is updated if overrides are detected. * @param bool $include_new * If set, include newly detected config not yet exported. * * @result array $different * The array of config items that are overridden. * * @see \Drupal\features\FeaturesManagerInterface::detectNew() */ public function detectOverrides(Package $feature, $include_new = FALSE); /** * Determines which config has not been exported to the feature. * * Typically added as an auto-detected dependency. * * @param \Drupal\features\Package $feature * The package array. * * @return array * The array of config items that are overridden. */ public function detectNew(Package $feature); /** * Determines which config is exported in the feature but not in the active. * * @param \Drupal\features\Package $feature * The package array. * * @return array * The array of config items that are missing from active store. */ public function detectMissing(Package $feature); /** * Sort the Missing config into order by dependencies. * @param array $missing config items * @return array of config items in dependency order */ public function reorderMissing(array $missing); /** * Helper function that returns a translatable label for the different status * constants. * * @param int $status * A status constant. * * @return string * A translatable label. */ public function statusLabel($status); /** * Helper function that returns a translatable label for the different state * constants. * * @param int $state * A state constant. * * @return string * A translatable label. */ public function stateLabel($state); /** * @param \Drupal\Core\Extension\Extension $extension * * @return array */ public function getFeaturesInfo(Extension $extension); }