Commit 9f2371f2 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2580935 by vaplas, maijs:...

Issue #2580935 by vaplas, maijs: DisplayPluginBase::applyDisplayCachablityMetadata() method has typo in it's name
parent 4c64f7b8
Loading
Loading
Loading
Loading
+1 −1
Changes for core/modules/block/src/Tests/Views/DisplayBlockTest.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -286,7 +286,7 @@ public function testBlockEmptyRendering() {

    $this->drupalGet($url);
    $this->assertEqual(0, count($this->xpath('//div[contains(@class, "block-views-blocktest-view-block-block-1")]')));
    // Ensure that the view cachability metadata is propagated even, for an
    // Ensure that the view cacheability metadata is propagated even, for an
    // empty block.
    $this->assertCacheTags(array_merge($block->getCacheTags(), ['block_view', 'config:block_list', 'config:views.view.test_view_block' , 'http_response', 'rendered']));
    $this->assertCacheContexts(['url.query_args:_wrapper_format']);
+1 −1
Changes for core/modules/rest/src/Plugin/views/display/RestExport.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -435,7 +435,7 @@ public function render() {
      $build['#markup'] = ViewsRenderPipelineMarkup::create($build['#markup']);
    }

    parent::applyDisplayCachablityMetadata($build);
    parent::applyDisplayCacheabilityMetadata($build);

    return $build;
  }
+1 −1
Changes for core/modules/user/src/Tests/Views/AccessRoleTest.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -126,7 +126,7 @@ public function testRenderCaching() {
    $account_switcher->switchTo($this->webUser);
    $result = $renderer->renderPlain($build);
    // @todo Fix this in https://www.drupal.org/node/2551037,
    // DisplayPluginBase::applyDisplayCachablityMetadata() is not invoked when
    // DisplayPluginBase::applyDisplayCacheabilityMetadata() is not invoked when
    // using buildBasicRenderable() and a Views access plugin returns FALSE.
    //$this->assertTrue(in_array('user.roles', $build['#cache']['contexts']));
    //$this->assertEqual([], $build['#cache']['tags']);
+19 −3
Changes for core/modules/views/src/Plugin/views/display/DisplayPluginBase.php: 19 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -2114,7 +2114,7 @@ public function render() {
      '#attached' => &$this->view->element['#attached'],
    );

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

    return $element;
  }
@@ -2125,7 +2125,7 @@ public function render() {
   * @param array $element
   *   The render array with updated cacheability metadata.
   */
  protected function applyDisplayCachablityMetadata(array &$element) {
  protected function applyDisplayCacheabilityMetadata(array &$element) {
    /** @var \Drupal\views\Plugin\views\cache\CachePluginBase $cache */
    $cache = $this->getPlugin('cache');

@@ -2137,6 +2137,22 @@ protected function applyDisplayCachablityMetadata(array &$element) {
      ->applyTo($element);
  }

  /**
   * Applies the cacheability of the current display to the given render array.
   *
   * @param array $element
   *   The render array with updated cacheability metadata.
   *
   * @deprecated in Drupal 8.4.0, will be removed before Drupal 9.0. Use
   *   DisplayPluginBase::applyDisplayCacheabilityMetadata instead.
   *
   * @see \Drupal\views\Plugin\views\display\DisplayPluginBase::applyDisplayCacheabilityMetadata()
   */
  protected function applyDisplayCachablityMetadata(array &$element) {
    @trigger_error('The DisplayPluginBase::applyDisplayCachablityMetadata method is deprecated since version 8.4 and will be removed in 9.0. Use DisplayPluginBase::applyDisplayCacheabilityMetadata instead.', E_USER_DEPRECATED);
    $this->applyDisplayCacheabilityMetadata($element);
  }

  /**
   * {@inheritdoc}
   */
@@ -2329,7 +2345,7 @@ public function buildRenderable(array $args = [], $cache = TRUE) {
    // of cacheability metadata (e.g.: cache contexts), so they can bubble up.
    // Thus, we add the cacheability metadata first, then modify / remove the
    // cache keys depending on the $cache argument.
    $this->applyDisplayCachablityMetadata($this->view->element);
    $this->applyDisplayCacheabilityMetadata($this->view->element);
    if ($cache) {
      $this->view->element['#cache'] += ['keys' => []];
      // Places like \Drupal\views\ViewExecutable::setCurrentPage() set up an
+1 −1
Changes for core/modules/views/src/Plugin/views/display/Feed.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -106,7 +106,7 @@ public function preview() {
  public function render() {
    $build = $this->view->style_plugin->render($this->view->result);

    $this->applyDisplayCachablityMetadata($build);
    $this->applyDisplayCacheabilityMetadata($build);

    return $build;
  }
Loading