You are here

function drush_structure_sync_import_menus in Structure Sync 8

Same name and namespace in other branches
  1. 2.x structure_sync.drush.inc \drush_structure_sync_import_menus()

Call back function drush_structure_sync_import_menus()

The call back function name in the following format drush_{module_name}_{item_id_for_command}()

1 call to drush_structure_sync_import_menus()
drush_structure_sync_import_all in ./structure_sync.drush.inc
Call back function drush_structure_sync_import_all()

File

./structure_sync.drush.inc, line 205
Drush commands for syncing structure content.

Code

function drush_structure_sync_import_menus($choice = FALSE) {
  drush_print('Importing menu links...');
  $options = [
    'full' => 'Full',
    'safe' => 'Safe',
    'force' => 'Force',
  ];
  if (!$choice) {
    $choice = drush_choice($options, 'What import style would you like?');
  }
  if ($choice && array_key_exists($choice, $options)) {
    drush_print('Using "' . $options[$choice] . '" import style');
    StructureSyncHelper::importMenuLinks([
      'style' => $choice,
      'drush' => TRUE,
    ]);
    drush_log('Successfully imported menu links', 'ok');
  }
  else {
    drush_log('No choice made for import style on importing menu links', 'error');
  }
}