You are here

public function DefaultContentCommands::contentExport in Default Content for D8 2.0.x

Same name and namespace in other branches
  1. 8 src/Commands/DefaultContentCommands.php \Drupal\default_content\Commands\DefaultContentCommands::contentExport()

Exports a single entity.

@command default-content:export @option file Write out the exported content to a file (must end with .yml) instead of stdout. @aliases dce

Parameters

string $entity_type_id: The entity type to export.

int $entity_id: The ID of the entity to export.

File

src/Commands/DefaultContentCommands.php, line 44

Class

DefaultContentCommands
Class DefaultContentCommands.

Namespace

Drupal\default_content\Commands

Code

public function contentExport($entity_type_id, $entity_id, $options = [
  'file' => NULL,
]) {
  $export = $this->defaultContentExporter
    ->exportContent($entity_type_id, $entity_id, $options['file']);
  if (!$options['file']) {
    $this
      ->output()
      ->write($export);
  }
}