Overridden view block title should be set on the view itself

Created on 16 July 2024, 3 months ago
Updated 6 September 2024, about 1 month ago

Problem/Motivation

It's currently impossible to access an overridden view block's title from within the view.

Steps to reproduce

Create a "Text area" footer item on a view that contains the "[view:title]" token. Observe that the title from the view's configuration is displayed instead of the overridden title from the block configuration.

Proposed resolution

Inject the overridden block title into the view using ViewExecutable::setTitle() in ViewBlock.

Remaining tasks

Make the change.

User interface changes

View blocks will now make use of the overridden title, falling back to the title found in the view's configuration as needed.

API changes

None.

Data model changes

None.

Release notes snippet

TBD.

✨ Feature request
Status

RTBC

Version

11.0 πŸ”₯

Component
ViewsΒ  β†’

Last updated about 2 hours ago

Created by

πŸ‡ΊπŸ‡ΈUnited States clayfreeman Paragould, AR

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @clayfreeman
  • Pipeline finished with Failed
    3 months ago
    Total: 580s
    #225880
  • Pipeline finished with Canceled
    3 months ago
    Total: 67s
    #225888
  • Pipeline finished with Failed
    3 months ago
    Total: 488s
    #225889
  • Pipeline finished with Failed
    3 months ago
    Total: 502s
    #225901
  • Pipeline finished with Failed
    3 months ago
    Total: 496s
    #225907
  • Pipeline finished with Success
    3 months ago
    Total: 485s
    #225923
  • Pipeline finished with Success
    3 months ago
    Total: 969s
    #225940
  • Issue was unassigned.
  • Status changed to Needs review 2 months ago
  • πŸ‡ΊπŸ‡ΈUnited States clayfreeman Paragould, AR
  • Status changed to RTBC 2 months ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Ran test-only feature

    1) Drupal\Tests\block\Functional\Views\DisplayBlockTest::testBlockRendering
    Failed asserting that the text of the element identified by '#test-view-block--title' equals 'Custom title'.
    Failed asserting that two strings are equal.
    --- Expected
    +++ Actual
    @@ @@
    -'Custom title'
    +'test_view_block'
    /builds/issue/drupal-3461896/core/tests/Drupal/Tests/WebAssert.php:807
    /builds/issue/drupal-3461896/core/modules/block/tests/src/Functional/Views/DisplayBlockTest.php:277
    FAILURES!
    Tests: 6, Assertions: 101, Failures: 1.
    

    Code wise believe this makes sense $this->configuration['views_label'] doesn't appear to be in $output['#title'] = ['#markup' => $this->view->getTitle(), '#allowed_tags' => Xss::getHtmlTagList()];

    So checking views_label probably didn't make sense. Think breaking up was the right call.

    Only think I'm iffy about is the removal of getConfiguration() if that's going to require any BC dance.

    otherwise LGTM.

  • Status changed to Needs work about 1 month ago
  • πŸ‡«πŸ‡·France nod_ Lille

    small tweak on the test

  • Pipeline finished with Failed
    about 1 month ago
    Total: 446s
    #275989
  • Pipeline finished with Success
    about 1 month ago
    Total: 482s
    #276001
  • Status changed to RTBC about 1 month ago
  • πŸ‡ΊπŸ‡ΈUnited States clayfreeman Paragould, AR

    Since this is a test-only nit, moving back to RTBC.

  • πŸ‡³πŸ‡ΏNew Zealand quietone

    Left a question in the MR.

  • Pipeline finished with Success
    14 days ago
    Total: 735s
    #300273
  • πŸ‡ΊπŸ‡ΈUnited States clayfreeman Paragould, AR
Production build 0.71.5 2024