ViewEvent.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /**
  3. * @link http://www.yiiframework.com/
  4. * @copyright Copyright (c) 2008 Yii Software LLC
  5. * @license http://www.yiiframework.com/license/
  6. */
  7. namespace yii\base;
  8. /**
  9. * ViewEvent represents events triggered by the [[View]] component.
  10. *
  11. * @author Qiang Xue <[email protected]>
  12. * @since 2.0
  13. */
  14. class ViewEvent extends Event
  15. {
  16. /**
  17. * @var string the rendering result of [[View::renderFile()]].
  18. * Event handlers may modify this property and the modified output will be
  19. * returned by [[View::renderFile()]]. This property is only used
  20. * by [[View::EVENT_AFTER_RENDER]] event.
  21. */
  22. public $output;
  23. /**
  24. * @var string the view file path that is being rendered by [[View::renderFile()]].
  25. */
  26. public $viewFile;
  27. /**
  28. * @var boolean whether to continue rendering the view file. Event handlers of
  29. * [[View::EVENT_BEFORE_RENDER]] may set this property to decide whether
  30. * to continue rendering the current view file.
  31. */
  32. public $isValid = true;
  33. /**
  34. * Constructor.
  35. * @param string $viewFile the view file path that is being rendered by [[View::renderFile()]].
  36. * @param array $config name-value pairs that will be used to initialize the object properties
  37. */
  38. public function __construct($viewFile, $config = [])
  39. {
  40. $this->viewFile = $viewFile;
  41. parent::__construct($config);
  42. }
  43. }