Commit 283d9f90 authored by damiankloip's avatar damiankloip Committed by tim.plunkett
Browse files

Added attachDisplays() method to ViewStorageController

parent 65b1a47c
......@@ -17,10 +17,7 @@ class ViewStorageController extends ConfigStorageController {
*/
protected function attachLoad(&$queried_entities, $revision_id = FALSE) {
foreach ($queried_entities as $id => $entity) {
foreach ($entity->display as $key => $options) {
// Create a ViewsDisplay object using the display options.
$entity->display[$key] = new ViewsDisplay($options);
}
$this->attachDisplays($entity);
}
}
......@@ -97,4 +94,25 @@ public function save(StorableInterface $entity) {
return $return;
}
/**
* Overrides Drupal\config\ConfigStorageController::create().
*/
public function create(array $values) {
$entity = parent::create($values);
$this->attachDisplays($entity);
return $entity;
}
/**
* @todo
*/
protected function attachDisplays(&$entity) {
if (isset($entity->display) && is_array($entity->display)) {
foreach ($entity->display as $key => $options) {
// Create a ViewsDisplay object using the display options.
$entity->display[$key] = new ViewsDisplay($options);
}
}
}
}
\ No newline at end of file
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