You are here

function drush_structure_sync_import_blocks in Structure Sync 8

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

Call back function drush_structure_sync_import_blocks()

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

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

File

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

Code

function drush_structure_sync_import_blocks($choice = FALSE) {
  drush_print('Importing blocks...');
  $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::importCustomBlocks([
      'style' => $choice,
      'drush' => TRUE,
    ]);
    drush_log('Successfully imported custom blocks', 'ok');
  }
  else {
    drush_log('No choice made for import style on importing custom blocks', 'error');
  }
}