code: public function beforeRender($viewFile, $params)
      {
          $event = new ViewEvent([
              'viewFile' => $viewFile,
              'params' => $params,
          ]);
          $this->trigger(self::EVENT_BEFORE_RENDER, $event);
  
          return $event->isValid;
      }
docs: This method is invoked right before [[renderFile()]] renders a view file.
  The default implementation will trigger the [[EVENT_BEFORE_RENDER]] event.
  If you override this method, make sure you call the parent implementation first.
  @param string $viewFile the view file to be rendered.
  @param array $params the parameter array passed to the [[render()]] method.
  @return bool whether to continue rendering the view file.