function yamlform_drush_command in YAML Form 8
Implements hook_drush_command().
File
- drush/
yamlform.drush.inc, line 18 - YAML Form module drush commands.
Code
function yamlform_drush_command() {
$items = [];
/* Submissions */
$items['yamlform-export'] = [
'description' => 'Exports form submissions to a file.',
'core' => [
'8+',
],
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_SITE,
'arguments' => [
'yamlform' => 'The form ID you want to export (required unless --entity-type and --entity-id are specified)',
],
'options' => [
// Delimited export options.
'delimiter' => 'Delimiter between columns (defaults to site-wide setting). This option may need to be wrapped in quotes. i.e. --delimiter="\\t".',
// Document and managed file export options.
'file-name' => 'File name used to export submission and uploaded filed. You may use tokens.',
// Tabular export options.
'header-keys' => 'Set to "label" (default) or "key"',
'options-item-format' => 'Set to "label" (default) or "key". Set to "key" to print select list values by their keys instead of labels.',
'options-format' => 'Set to "separate" (default) or "compact" to determine how select list values are exported.',
'entity-reference-format' => 'Set to "link" (default) or "id" to determine how entity references are exported.',
'excluded-columns' => 'Comma-separated list of component IDs or form keys to exclude.',
// Download options.
'entity-type' => 'The entity type to which this submission was submitted from.',
'entity-id' => 'The ID of the entity of which this form submission was submitted from.',
'range-type' => 'Range of submissions to export: "all", "latest", "serial", "sid", or "date".',
'range-latest' => 'Integer specifying the latest X submissions will be downloaded. Used if "range-type" is "latest" or no other range options are provided.',
'range-start' => 'The submission ID or start date at which to start exporting.',
'range-end' => 'The submission ID or end date at which to end exporting.',
'state' => 'Submission state to be included: "completed", "draft" or "all" (default).',
'sticky' => 'Flagged/starred submission status.',
'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.',
// Output options.
'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 commandline.',
],
'aliases' => [
'yfx',
],
];
$items['yamlform-purge'] = [
'description' => "Purge form submissions from the databases",
'core' => [
'8+',
],
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_SITE,
'arguments' => [
'yamlform_id' => "A form machine name. If not provided, user may choose from a list of names.",
],
'options' => [
'all' => 'Flush all submissions',
'entity-type' => 'The entity type for form submissions to be purged',
'entity-id' => 'The ID of the entity for form submissions to be purged',
],
'examples' => [
'drush yamlform-purge' => 'Pick a form and then purge its submissions.',
'drush yamlform-purge contact' => "Delete 'Contact' form submissions.",
'drush yamlform-purge --all' => 'Purge all form submissions.',
],
'aliases' => [
'yfp',
],
];
/* Tidy */
$items['yamlform-tidy'] = [
'description' => "Tidy export form configuration files",
'core' => [
'8+',
],
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_ROOT,
'options' => [
'dependencies' => 'Add module dependencies to installed form and options configuration entities.',
],
'arguments' => [
'module' => "The module that needs its YAML configuration files (config/install) tidied. (Defaults to yamlform)",
],
'examples' => [
'drush yamlform-tidy yamlform' => "Tidies YAML configuration files in 'yamlform/config' for the YAML Form module",
],
'aliases' => [
'yft',
],
];
/* Libraries */
$items['yamlform-libraries-status'] = [
'description' => 'Displays the status of third party libraries required by the YAML Form module.',
'core' => [
'8+',
],
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_ROOT,
'examples' => [
'yamlform-libraries-status' => 'Displays the status of third party libraries required by the YAML Form module.',
],
'aliases' => [
'yfls',
],
];
$items['yamlform-libraries-download'] = [
'description' => 'Download third party libraries required by the YAML Form module.',
'core' => [
'8+',
],
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_ROOT,
'examples' => [
'yamlform-libraries-download' => 'Download third party libraries required by the YAML Form module.',
],
'aliases' => [
'yfld',
],
];
$items['yamlform-libraries-remove'] = [
'description' => 'Removes all downloaded third party libraries required by the YAML Form module.',
'core' => [
'8+',
],
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_ROOT,
'examples' => [
'yamlform-libraries-remove' => 'Removes all downloaded third party libraries required by the YAML Form module.',
],
'aliases' => [
'yflr',
],
];
/* Devel Generate */
$items['yamlform-generate'] = [
'callback' => 'drush_devel_generate',
'callback arguments' => [
'plugin_id' => 'yamlform_submission',
],
'description' => 'Create submissions in specified form.',
'arguments' => [
'yamlform_id' => 'Form id into which new submissions will be inserted.',
'num' => 'Number of submissions to insert. Defaults to 50.',
],
'options' => [
'kill' => 'Delete all submissions in specified form before generating.',
'feedback' => 'An integer representing interval for insertion rate logging. Defaults to 1000',
'entity-type' => 'The entity type to which this submission was submitted from.',
'entity-id' => 'The ID of the entity of which this form submission was submitted from.',
],
'aliases' => [
'yfg',
],
];
/* Repair */
$items['yamlform-repair'] = [
'description' => 'Makes sure all YAML Form admin settings and forms are up-to-date.',
'core' => [
'8+',
],
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_ROOT,
'examples' => [
'yamlform-repair' => 'Repairs admin settings and forms are up-to-date.',
],
'aliases' => [
'yfr',
],
];
return $items;
}