Commit 9d4d0e2b authored by catch's avatar catch

Issue #1820526 by damiankloip, pdrake: Remove UUID generation code from load()...

Issue #1820526 by damiankloip, pdrake: Remove UUID generation code from load() method in ViewStorageController.
parent f0540465
......@@ -9,20 +9,12 @@
use Drupal\Core\Config\Entity\ConfigStorageController;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Component\Uuid\Uuid;
/**
* Defines the storage controller class for View entities.
*/
class ViewStorageController extends ConfigStorageController {
/**
* Holds a UUID factory instance.
*
* @var Drupal\Component\Uuid\Uuid
*/
protected $uuidFactory = NULL;
/**
* Overrides Drupal\config\ConfigStorageController::load();
*/
......@@ -43,14 +35,6 @@ public function load(array $ids = NULL) {
*/
protected function attachLoad(&$queried_entities, $revision_id = FALSE) {
foreach ($queried_entities as $id => $entity) {
// Create a uuid if we don't have one.
if (empty($entity->{$this->uuidKey})) {
// Only get an instance of uuid once.
if (!isset($this->uuidFactory)) {
$this->uuidFactory = new Uuid();
}
$entity->{$this->uuidKey} = $this->uuidFactory->generate();
}
$this->attachDisplays($entity);
}
......
......@@ -78,6 +78,19 @@ function views_pre_render_view_element($element) {
return $element;
}
/**
* Implements hook_config_import_create().
*/
function views_config_import_create($name, $new_config, $old_config) {
if (strpos($name, 'views.view.') !== 0) {
return FALSE;
}
$view = entity_create('view', $new_config->get());
$view->save();
return TRUE;
}
/**
* Implement hook_theme(). Register views theming functions.
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment