diff core/modules/views/src/Ajax/ViewAjaxResponse.php @ 0:c75dbcec494b

Initial commit from drush-created site
author Chris Cannam
date Thu, 05 Jul 2018 14:24:15 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/core/modules/views/src/Ajax/ViewAjaxResponse.php	Thu Jul 05 14:24:15 2018 +0000
@@ -0,0 +1,42 @@
+<?php
+
+namespace Drupal\views\Ajax;
+
+use Drupal\Core\Ajax\AjaxResponse;
+use Drupal\views\ViewExecutable;
+
+/**
+ * Custom JSON response object for an ajax view response.
+ *
+ * We use a special response object to be able to fire a proper alter hook.
+ */
+class ViewAjaxResponse extends AjaxResponse {
+
+  /**
+   * The view executed on this ajax request.
+   *
+   * @var \Drupal\views\ViewExecutable
+   */
+  protected $view;
+
+  /**
+   * Sets the executed view of this response.
+   *
+   * @param \Drupal\views\ViewExecutable $view
+   *   The View executed on this ajax request.
+   */
+  public function setView(ViewExecutable $view) {
+    $this->view = $view;
+  }
+
+  /**
+   * Gets the executed view of this response.
+   *
+   * @return \Drupal\views\ViewExecutable
+   *   The View executed on this ajax request.
+   */
+  public function getView() {
+    return $this->view;
+  }
+
+}