function drush_features_export in Features 6
Same name and namespace in other branches
- 8.4 drush/features.drush8.inc \drush_features_export()
- 8.3 drush/features.drush8.inc \drush_features_export()
- 7.2 features.drush.inc \drush_features_export()
- 7 features.drush.inc \drush_features_export()
Create a feature module based on a list of components.
File
- ./
features.drush.inc, line 149 - Features module drush integration.
Code
function drush_features_export() {
$args = func_get_args();
if (count($args) == 1) {
// Assume that the user intends to create a module with the same name as the
// "value" of the component.
list($source, $component) = explode(':', $args[0]);
$stub = array(
$source => array(
$component,
),
);
_drush_features_export($stub, $component);
}
elseif (count($args) > 1) {
// Assume that the user intends to create a new module based on a list of
// components. First argument is assumed to be the name.
$name = array_shift($args);
$stub = array();
foreach ($args as $v) {
list($source, $component) = explode(':', $v);
$stub[$source][] = $component;
}
_drush_features_export($stub, array(), $name);
}
else {
$rows = array(
array(
dt('Available sources'),
),
);
foreach (features_get_components(TRUE) as $component => $info) {
if ($options = features_invoke($component, 'features_export_options')) {
foreach ($options as $key => $value) {
$rows[] = array(
$component . ':' . $key,
);
}
}
}
drush_print_table($rows, TRUE);
}
}