public function DefaultContentDeployCommands::contentDeployImport in Default Content Deploy 8
Import all the content defined in a content directory.
@command default-content-deploy:import
@option force-override All existing content will be overridden to the state defined in a content directory. @option preserve-password Preserve existing user password. @usage drush dcdi Import content. Existing older content with matching UUID will be updated. Newer content and existing content with different UUID will be ignored. @usage drush dcdi --folder='../content' Import content from the specified folder. @usage drush dcdi --force-override All existing content will be overridden (locally updated default content will be reverted to the state defined in a content directory). @usage drush dcdi --verbose Print detailed information about importing entities. @aliases dcdi,default-content-deploy-import
Parameters
array $options: An associative array of options whose values come from cli, aliases, config, etc.
Throws
\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
\Drupal\Component\Plugin\Exception\PluginNotFoundException
\Drupal\Core\Entity\EntityStorageException
File
- src/
Commands/ DefaultContentDeployCommands.php, line 277
Class
- DefaultContentDeployCommands
- Class DefaultContentDeployCommands.
Namespace
Drupal\default_content_deploy\CommandsCode
public function contentDeployImport(array $options = [
'force-override' => FALSE,
'folder' => self::OPT,
]) {
// Perform read only update.
$this->importer
->setForceOverride($options['force-override']);
if (!empty($options['folder'])) {
$this->importer
->setFolder($options['folder']);
}
$this->importer
->prepareForImport();
$this
->displayImportResult();
if (!$this
->isAllSkip() && $this
->io()
->confirm(dt('Do you really want to continue?'))) {
$this->importer
->import();
$this
->io()
->success(dt('Content has been imported.'));
}
}