You are here

public function WebformCommands::drush_webform_export in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Commands/WebformCommands.php \Drupal\webform\Commands\WebformCommands::drush_webform_export()

Exports webform submissions to a file.

@command webform:export

@option exporter The type of export. (delimited, table, yaml, or json) @option delimiter Delimiter between columns (defaults to site-wide setting). This option may need to be wrapped in quotes. i.e. --delimiter="\t". @option multiple-delimiter Delimiter between an element with multiple values (defaults to site-wide setting). @option file-name File name used to export submission and uploaded filed. You may use tokens. @option archive-type Archive file type for submission file uploadeds and generated records. (tar or zip) @option header-format Set to "label" (default) or "key" @option options-item-format Set to "label" (default) or "key". Set to "key" to print select list values by their keys instead of labels. @option options-single-format Set to "separate" (default) or "compact" to determine how single select list values are exported. @option options-multiple-format Set to "separate" (default) or "compact" to determine how multiple select list values are exported. @option entity-reference-items Comma-separated list of entity reference items (id, title, and/or url) to be exported. @option excluded-columns Comma-separated list of component IDs or webform keys to exclude. @option uuid Use UUIDs for all entity references. (Only applies to CSV download) @option entity-type The entity type to which this submission was submitted from. @option entity-id The ID of the entity of which this webform submission was submitted from. @option range-type Range of submissions to export: "all", "latest", "serial", "sid", or "date". @option range-latest Integer specifying the latest X submissions will be downloaded. Used if "range-type" is "latest" or no other range options are provided. @option range-start The submission ID or start date at which to start exporting. @option range-end The submission ID or end date at which to end exporting. @option uid The ID of the user who submitted the form. @option order The submission order "asc" (default) or "desc". @option state Submission state to be included: "completed", "draft" or "all" (default). @option sticky Flagged/starred submission status. @option files Download files: "1" or "0" (default). If set to 1, the exported CSV file and any submission file uploads will be download in a gzipped tar file. @option destination The full path and filename in which the CSV or archive should be stored. If omitted the CSV file or archive will be outputted to the command line. @aliases wfx,webform-export

Parameters

$webform The webform ID you want to export (required unless --entity-type and --entity-id are specified):

File

src/Commands/WebformCommands.php, line 63

Class

WebformCommands
Webform commands for Drush 9.x.

Namespace

Drupal\webform\Commands

Code

public function drush_webform_export($webform = NULL, array $options = [
  'exporter' => NULL,
  'delimiter' => NULL,
  'multiple-delimiter' => NULL,
  'file-name' => NULL,
  'archive-type' => NULL,
  'header-format' => NULL,
  'options-item-format' => NULL,
  'options-single-format' => NULL,
  'options-multiple-format' => NULL,
  'entity-reference-items' => NULL,
  'excluded-columns' => NULL,
  'uuid' => NULL,
  'entity-type' => NULL,
  'entity-id' => NULL,
  'range-type' => NULL,
  'range-latest' => NULL,
  'range-start' => NULL,
  'range-end' => NULL,
  'uid' => NULL,
  'order' => NULL,
  'state' => NULL,
  'sticky' => NULL,
  'files' => NULL,
  'destination' => NULL,
]) {
  $this->cliService
    ->drush_webform_export($webform);
}