Skip to content
Snippets Groups Projects
Commit 283d9f90 authored by Damian Lee's avatar Damian Lee Committed by Tim Plunkett
Browse files

Added attachDisplays() method to ViewStorageController

parent 65b1a47c
No related branches found
No related tags found
No related merge requests found
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment