code: public function afterRender($viewFile, $params, &$output)
      {
          if ($this->hasEventHandlers(self::EVENT_AFTER_RENDER)) {
              $event = new ViewEvent([
                  'viewFile' => $viewFile,
                  'params' => $params,
                  'output' => $output,
              ]);
              $this->trigger(self::EVENT_AFTER_RENDER, $event);
              $output = $event->output;
          }
      }
docs: This method is invoked right after [[renderFile()]] renders a view file.
  The default implementation will trigger the [[EVENT_AFTER_RENDER]] event.
  If you override this method, make sure you call the parent implementation first.
  @param string $viewFile the view file being rendered.
  @param array $params the parameter array passed to the [[render()]] method.
  @param string $output the rendering result of the view file. Updates to this parameter
  will be passed back and returned by [[renderFile()]].