summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFido van den Bos2018-01-31 12:31:10 (GMT)
committerFido van den Bos2018-01-31 12:31:10 (GMT)
commitada82b51e459c1a9fbcdf9cb620c7112c7f1b5f0 (patch)
tree264f230201693daf0ae849d3e354ab87e35983d7
parentd4677fc853920066cbb8e225f3299bec2d79026c (diff)
parent1f13d438b9452de0544bd08a2cc2fb73829c9d1d (diff)
Merge branch '8.x-1.x' of git.drupal.org:project/structure_sync into 8.x-1.x8.x-1.6
-rwxr-xr-xstructure_sync.drush.inc37
1 files changed, 24 insertions, 13 deletions
diff --git a/structure_sync.drush.inc b/structure_sync.drush.inc
index 6501b48..2af8f0f 100755
--- a/structure_sync.drush.inc
+++ b/structure_sync.drush.inc
@@ -11,6 +11,7 @@ use Drupal\structure_sync\StructureSyncHelper;
* Implements hook_drush_command().
*/
function structure_sync_drush_command() {
+ $arguments = ['arguments' => ['choice' => 'The choice as argument']];
$items = [];
$items['export-taxonomies'] = [
'description' => 'Export the taxonomies',
@@ -21,6 +22,7 @@ function structure_sync_drush_command() {
'description' => 'Import the taxonomies',
'drupal dependencies' => ['structure_sync'],
'aliases' => ['it'],
+ $arguments,
];
$items['export-blocks'] = [
'description' => 'Export blocks',
@@ -31,6 +33,7 @@ function structure_sync_drush_command() {
'description' => 'Import blocks',
'drupal dependencies' => ['structure_sync'],
'aliases' => ['ib'],
+ $arguments,
];
$items['export-menus'] = [
'description' => 'Export menu links',
@@ -41,12 +44,14 @@ function structure_sync_drush_command() {
'description' => 'Import menu links',
'drupal dependencies' => ['structure_sync'],
'aliases' => ['im'],
+ $arguments,
];
$items['import-all'] = [
'description' => 'Import menu links, Taxonomy and Blocks',
'drupal dependencies' => ['structure_sync'],
'aliases' => ['ia'],
+ $arguments,
];
$items['export-all'] = [
@@ -63,10 +68,10 @@ function structure_sync_drush_command() {
* The call back function name in the following format
* drush_{module_name}_{item_id_for_command}()
*/
-function drush_structure_sync_import_all() {
- drush_structure_sync_import_taxonomies();
- drush_structure_sync_import_menus();
- drush_structure_sync_import_blocks();
+function drush_structure_sync_import_all($choice = FALSE) {
+ drush_structure_sync_import_taxonomies($choice);
+ drush_structure_sync_import_menus($choice);
+ drush_structure_sync_import_blocks($choice);
}
/**
@@ -101,7 +106,7 @@ function drush_structure_sync_export_taxonomies() {
* The call back function name in the following format
* drush_{module_name}_{item_id_for_command}()
*/
-function drush_structure_sync_import_taxonomies() {
+function drush_structure_sync_import_taxonomies($choice = FALSE) {
drush_print('Importing taxonomies...');
$options = [
@@ -110,9 +115,11 @@ function drush_structure_sync_import_taxonomies() {
'force' => 'Force',
];
- $choice = drush_choice($options, 'What import style would you like?');
+ if (!$choice) {
+ $choice = drush_choice($options, 'What import style would you like?');
+ }
- if ($choice) {
+ if ($choice && array_key_exists($choice, $options)) {
drush_print('Using "' . $options[$choice] . '" import style');
StructureSyncHelper::importTaxonomies([
@@ -147,7 +154,7 @@ function drush_structure_sync_export_blocks() {
* The call back function name in the following format
* drush_{module_name}_{item_id_for_command}()
*/
-function drush_structure_sync_import_blocks() {
+function drush_structure_sync_import_blocks($choice = FALSE) {
drush_print('Importing blocks...');
$options = [
@@ -156,9 +163,11 @@ function drush_structure_sync_import_blocks() {
'force' => 'Force',
];
- $choice = drush_choice($options, 'What import style would you like?');
+ if (!$choice) {
+ $choice = drush_choice($options, 'What import style would you like?');
+ }
- if ($choice) {
+ if ($choice && array_key_exists($choice, $options)) {
drush_print('Using "' . $options[$choice] . '" import style');
StructureSyncHelper::importCustomBlocks([
@@ -193,7 +202,7 @@ function drush_structure_sync_export_menus() {
* The call back function name in the following format
* drush_{module_name}_{item_id_for_command}()
*/
-function drush_structure_sync_import_menus() {
+function drush_structure_sync_import_menus($choice = FALSE) {
drush_print('Importing menu links...');
$options = [
@@ -202,9 +211,11 @@ function drush_structure_sync_import_menus() {
'force' => 'Force',
];
- $choice = drush_choice($options, 'What import style would you like?');
+ if (!$choice) {
+ $choice = drush_choice($options, 'What import style would you like?');
+ }
- if ($choice) {
+ if ($choice && array_key_exists($choice, $options)) {
drush_print('Using "' . $options[$choice] . '" import style');
StructureSyncHelper::importMenuLinks([