3 namespace Drupal\views;
6 * Caches exposed forms, as they are heavy to generate.
8 * @see \Drupal\views\Form\ViewsExposedForm
10 class ExposedFormCache {
13 * Stores the exposed form data.
17 protected $cache = [];
20 * Save the Views exposed form for later use.
22 * @param string $view_id
24 * @param string $display_id
25 * The current view display name.
26 * @param array $form_output
27 * The form structure. Only needed when inserting the value.
29 public function setForm($view_id, $display_id, array $form_output) {
30 // Save the form output.
31 $views_exposed[$view_id][$display_id] = $form_output;
35 * Retrieves the views exposed form from cache.
37 * @param string $view_id
39 * @param string $display_id
40 * The current view display name.
43 * The form structure, if any, otherwise FALSE.
45 public function getForm($view_id, $display_id) {
46 // Return the form output, if any.
47 if (empty($this->cache[$view_id][$display_id])) {
51 return $this->cache[$view_id][$display_id];
56 * Rests the form cache.
58 public function reset() {