You are here

public function WebformCliService::drush_webform_import_validate in Webform 8.5

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

File

src/Commands/WebformCliService.php, line 388

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;
}