public function ViewExecutable::__wakeup in Drupal 9
Same name and namespace in other branches
- 8 core/modules/views/src/ViewExecutable.php \Drupal\views\ViewExecutable::__wakeup()
Magic method implementation to unserialize the view executable.
File
- core/
modules/ views/ src/ ViewExecutable.php, line 2510
Class
- ViewExecutable
- Represents a view as a whole.
Namespace
Drupal\viewsCode
public function __wakeup() {
// There are cases, like in testing where we don't have a container
// available.
if (\Drupal::hasContainer() && !empty($this->serializationData)) {
// Load and reference the storage.
$this->storage = \Drupal::entityTypeManager()
->getStorage('view')
->load($this->serializationData['storage']);
$this->storage
->set('executable', $this);
// Attach all necessary services.
$this->user = \Drupal::currentUser();
$this->viewsData = \Drupal::service($this->serializationData['views_data']);
$this->routeProvider = \Drupal::service($this->serializationData['route_provider']);
// Restore the state of this executable.
if ($request = \Drupal::request()) {
$this
->setRequest($request);
}
$this
->setDisplay($this->serializationData['current_display']);
$this
->setArguments($this->serializationData['args']);
$this
->setCurrentPage($this->serializationData['current_page']);
$this
->setExposedInput($this->serializationData['exposed_input']);
$this->exposed_data = $this->serializationData['exposed_data'];
$this->exposed_raw_input = $this->serializationData['exposed_raw_input'];
$this->dom_id = $this->serializationData['dom_id'];
$this
->initHandlers();
// If the display was previously executed, execute it now.
if ($this->serializationData['executed']) {
$this
->execute($this->current_display);
}
}
// Unset serializationData since it serves no further purpose.
unset($this->serializationData);
}