You are here

class PreCacheEvent in Views Json Source 8

Class PreCacheEvent.

Hierarchy

  • class \Drupal\views_json_source\Event\PreCacheEvent extends \Symfony\Component\EventDispatcher\Event

Expanded class hierarchy of PreCacheEvent

1 file declares its use of PreCacheEvent
ViewsJsonQuery.php in src/Plugin/views/query/ViewsJsonQuery.php

File

src/Event/PreCacheEvent.php, line 11

Namespace

Drupal\views_json_source\Event
View source
class PreCacheEvent extends Event {

  /**
   * Pre cache constant.
   */
  const VIEWS_JSON_SOURCE_PRE_CACHE = 'views_json_source.pre_cache';

  /**
   * The view executable.
   *
   * @var \Drupal\views\ViewExecutable
   */
  protected $viewExecutable;

  /**
   * The views json query result body.
   *
   * @var string
   */
  protected $data;

  /**
   * Constructs the object.
   *
   * @param \Drupal\views\ViewExecutable $viewExecutable
   *   The view executable.
   * @param string $data
   *   The views json query result body.
   */
  public function __construct(ViewExecutable $viewExecutable, string $data) {
    $this->viewExecutable = $viewExecutable;
    $this->data = $data;
  }

  /**
   * Get view executable.
   *
   * @return \Drupal\views\ViewExecutable
   *   Return view executable.
   */
  public function getViewExecutable() : ViewExecutable {
    return $this->viewExecutable;
  }

  /**
   * Get view result data.
   *
   * @return string
   *   Return view data.
   */
  public function getViewData() : string {
    return $this->data;
  }

  /**
   * Set the data for this event.
   *
   * @param string $data
   *   The data to override view result data.
   */
  public function setViewData(string $data) {
    $this->data = $data;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
PreCacheEvent::$data protected property The views json query result body.
PreCacheEvent::$viewExecutable protected property The view executable.
PreCacheEvent::getViewData public function Get view result data.
PreCacheEvent::getViewExecutable public function Get view executable.
PreCacheEvent::setViewData public function Set the data for this event.
PreCacheEvent::VIEWS_JSON_SOURCE_PRE_CACHE constant Pre cache constant.
PreCacheEvent::__construct public function Constructs the object.