Overridden view block title should be set on the view itself

Created on 16 July 2024, 5 months 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

Active

Version

11.0 πŸ”₯

Component
ViewsΒ  β†’

Last updated 2 days 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
    5 months ago
    Total: 580s
    #225880
  • Pipeline finished with Canceled
    5 months ago
    Total: 67s
    #225888
  • Pipeline finished with Failed
    5 months ago
    Total: 488s
    #225889
  • Pipeline finished with Failed
    5 months ago
    Total: 502s
    #225901
  • Pipeline finished with Failed
    5 months ago
    Total: 496s
    #225907
  • Pipeline finished with Success
    5 months ago
    Total: 485s
    #225923
  • Pipeline finished with Success
    5 months ago
    Total: 969s
    #225940
  • Issue was unassigned.
  • Status changed to Needs review 5 months ago
  • πŸ‡ΊπŸ‡ΈUnited States clayfreeman Paragould, AR
  • Status changed to RTBC 4 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 4 months ago
  • πŸ‡«πŸ‡·France nod_ Lille

    small tweak on the test

  • Pipeline finished with Failed
    4 months ago
    Total: 446s
    #275989
  • Pipeline finished with Success
    4 months ago
    Total: 482s
    #276001
  • Status changed to RTBC 4 months 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
    3 months ago
    Total: 735s
    #300273
  • πŸ‡ΊπŸ‡ΈUnited States clayfreeman Paragould, AR
  • πŸ‡³πŸ‡ΏNew Zealand quietone

    Thanks. I don't see any remaining work here but will leave for another committer to have a look. Updating credit.

    • larowlan β†’ committed c836e0a0 on 11.x
      Issue #3461896 by clayfreeman, quietone, smustgrave, nod_: Overridden...
  • πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10

    Committed to 11.x - thanks!

  • Status changed to Fixed about 1 month ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024