postRender example

foreach ($this->view->field as $id => $field) {
      // If the raw output option has been set, just get the raw value.       if (!empty($this->rawOutputOptions[$id])) {
        $value = $field->getValue($row);
      }
      // Otherwise, get rendered field.       else {
        // Advanced render for token replacement.         $markup = $field->advancedRender($row);
        // Post render to support uncacheable fields.         $field->postRender($row$markup);
        $value = $field->last_render;
      }

      // Omit excluded fields from the rendered output.       if (empty($field->options['exclude'])) {
        $output[$this->getFieldKeyAlias($id)] = $value;
      }
    }

    return $output;
  }

  
return parent::renderTitle($o);
    }

    public function preRender(): string
    {
        return PHP_EOL;
    }

    public function postRender(): string
    {
        if ($this->windows_output) {
            return $this->utf8ToWindows(parent::postRender());
        }

        return parent::postRender();
    }

    public function escape(string $string$encoding = false): string
    {
        return \str_replace("\x1b", '\\x1b', $string);
    }

    protected function utf8ToWindows(string $string): string
    {
            if (!$this->getForcePreRender()) {
                self::$needs_pre_render = false;
            }
        }

        return $output.'<div class="kint-plain">';
    }

    public function postRender(): string
    {
        if (self::$disable_utf8) {
            return $this->utf8ToHtmlentity(parent::postRender()).'</div>';
        }

        return parent::postRender().'</div>';
    }

    public function ideLink(string $file, int $line): string
    {
        $path = $this->escape(Kint::shortenPath($file)).':'.$line;
        $ideLink = Kint::getIdeLink($file$line);

        if (!$ideLink) {
            

          else {
            $renderer->renderPlain($data);
          }

          // Extract field output from the render array and post process it.           $fields = $this->view->field;
          $rendered_fields = &$this->rendered_fields[$index];
          $post_render_tokens = [];
          foreach ($field_ids as $id) {
            $rendered_fields[$id] = $data[$id]['#markup'];
            $tokens = $fields[$id]->postRender($row$rendered_fields[$id]);
            if ($tokens) {
              $post_render_tokens += $tokens;
            }
          }

          // Populate row tokens.           $this->rowTokens[$index] = $this->view->field[$render_tokens_field_id]->getRenderTokens([]);

          // Replace post-render tokens.           if ($post_render_tokens) {
            $placeholders = array_keys($post_render_tokens);
            
if ([] === $vars) {
            $output .= $this->renderer->renderNothing();
        }

        foreach ($vars as $key => $arg) {
            if (!$base[$key] instanceof Value) {
                throw new InvalidArgumentException('Kint::dumpAll requires all elements of the second argument to be Value instances');
            }
            $output .= $this->dumpVar($arg$base[$key]);
        }

        $output .= $this->renderer->postRender();

        return $output;
    }

    /** * Dumps and renders a var. * * @param mixed &$var Data to dump * @param Value $base Base object */
    protected function dumpVar(&$var, Value $base): string
    {
// Let the themes play too, because prerender is a very themey thing.     foreach ($themes as $theme_name) {
      $function = $theme_name . '_views_pre_render';
      if (function_exists($function)) {
        $function($this);
      }
    }

    $this->display_handler->output = $this->display_handler->render();

    $exposed_form->postRender($this->display_handler->output);

    $cache->postRender($this->display_handler->output);

    // Let modules modify the view output after it is rendered.     $module_handler->invokeAll('views_post_render', [$this, &$this->display_handler->output, $cache]);

    // Let the themes play too, because post render is a very themey thing.     foreach ($themes as $theme_name) {
      $function = $theme_name . '_views_post_render';
      if (function_exists($function)) {
        $function($this$this->display_handler->output, $cache);
      }

  protected function renderCounter(Counter $handler, ResultRow $row) {
    $markup = $handler->render($row);
    $handler->postRender($row$markup);
    return $handler->last_render;
  }

}
Home | Imprint | This part of the site doesn't use cookies.