You are here

function drush_default_content_export_module in Default Content for D8 8

Same name and namespace in other branches
  1. 2.0.x drush/default_content.drush.inc \drush_default_content_export_module()

Exports all of the content for a given module.

Parameters

string $module_name: The module name to export.

File

drush/default_content.drush.inc, line 101
Drush integration for the default_content module.

Code

function drush_default_content_export_module($module_name) {

  /** @var \Drupal\default_content\DefaultContentExporterInterface $exporter */
  $exporter = \Drupal::service('default_content.exporter');
  $serialized_by_type = $exporter
    ->exportModuleContent($module_name);
  $module_folder = \Drupal::moduleHandler()
    ->getModule($module_name)
    ->getPath() . '/content';
  $exporter
    ->writeDefaultContent($serialized_by_type, $module_folder);
}