applyDisplayCacheabilityMetadata example

      // renderer is designed for HTML rendering, it filters #markup for XSS       // unless it is already known to be safe, but that filter only works for       // HTML. Therefore, we mark the contents as safe to bypass the filter. So       // long as we are returning this in a non-HTML response,       // this is safe, because an XSS attack only works when executed by an HTML       // agent.       // @todo Decide how to support non-HTML in the render API in       // https://www.drupal.org/node/2501313.       $build['#markup'] = ViewsRenderPipelineMarkup::create($build['#markup']);
    }

    parent::applyDisplayCacheabilityMetadata($build);

    return $build;
  }

  /** * {@inheritdoc} * * The DisplayPluginBase preview method assumes we will be returning a render * array. The data plugin will already return the serialized string. */
  public function preview() {
    


    return $output;
  }

  /** * {@inheritdoc} */
  public function render() {
    $build = $this->view->style_plugin->render($this->view->result);

    $this->applyDisplayCacheabilityMetadata($build);

    return $build;
  }

  /** * {@inheritdoc} */
  public function defaultableSections($section = NULL) {
    $sections = parent::defaultableSections($section);

    if (in_array($section['style', 'row'])) {
      
$element = [
      '#theme' => $this->themeFunctions(),
      '#view' => $this->view,
      '#pre_render' => [[$this, 'elementPreRender']],
      '#rows' => $rows,
      // Assigned by reference so anything added in $element['#attached'] will       // be available on the view.       '#attached' => &$this->view->element['#attached'],
      '#cache' => &$this->view->element['#cache'],
    ];

    $this->applyDisplayCacheabilityMetadata($this->view->element);

    return $element;
  }

  /** * {@inheritdoc} */
  public static function trustedCallbacks() {
    $callbacks = parent::trustedCallbacks();
    $callbacks[] = 'elementPreRender';
    return $callbacks;
  }
Home | Imprint | This part of the site doesn't use cookies.