You are here

public function WebformCliService::drush_webform_import_validate in Webform 6.x

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

File

src/Commands/WebformCliService.php, line 389

Class

WebformCliService
Drush version agnostic commands.

Namespace

Drupal\webform\Commands

Code

public function drush_webform_import_validate($webform_id = NULL, $import_uri = NULL) {
  if (!\Drupal::moduleHandler()
    ->moduleExists('webform_submission_export_import')) {
    return $this
      ->drush_set_error($this
      ->dt('The Webform Submission Export/Import module must be enabled to perform imports.'));
  }
  if ($errors = $this
    ->_drush_webform_validate($webform_id)) {
    return $errors;
  }
  if (empty($import_uri)) {
    return $this
      ->drush_set_error($this
      ->dt('Please include the CSV path or URI.'));
  }
  if (file_exists($import_uri)) {
    return NULL;
  }
  return NULL;
}