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
Branches
Tags
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -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.
Please register or to comment