function ViewExecutable::__sleep

Same name and namespace in other branches
  1. 9 core/modules/views/src/ViewExecutable.php \Drupal\views\ViewExecutable::__sleep()
  2. 8.9.x core/modules/views/src/ViewExecutable.php \Drupal\views\ViewExecutable::__sleep()
  3. 11.x core/modules/views/src/ViewExecutable.php \Drupal\views\ViewExecutable::__sleep()

Magic method implementation to serialize the view executable.

Return value

array The names of all variables that should be serialized.

File

core/modules/views/src/ViewExecutable.php, line 2539

Class

ViewExecutable
Represents a view as a whole.

Namespace

Drupal\views

Code

public function __sleep() {
  // Limit to only the required data which is needed to properly restore the
  // state during unserialization.
  $this->serializationData = [
    'storage' => $this->storage
      ->id(),
    'current_display' => $this->current_display,
    'args' => $this->args,
    'current_page' => $this->current_page,
    'exposed_input' => $this->exposed_input,
    'exposed_raw_input' => $this->exposed_raw_input,
    'exposed_data' => $this->exposed_data,
    'dom_id' => $this->dom_id,
    'executed' => $this->executed,
  ];
  return [
    'serializationData',
  ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.