diff --git a/lib/Drupal/views/View.php b/lib/Drupal/views/View.php index 6a00fe99aae339791cb8fb342c49280addf4809e..fbc653e33240ced18d38259208f6dee4e03487e0 100644 --- a/lib/Drupal/views/View.php +++ b/lib/Drupal/views/View.php @@ -1828,6 +1828,11 @@ function save() { if ($this->vid == 'new') { $this->vid = NULL; } + // If there is no vid, check if a view with this machine name already exists. + elseif (empty($this->vid)) { + $vid = db_query("SELECT vid from {views_view} WHERE name = :name", array(':name' => $this->name))->fetchField(); + $this->vid = $vid ? $vid : NULL; + } $transaction = db_transaction();