Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
The proper way to retrieve an upcasted route parameter is via the RouteMatch
. BookNavigationBlock
and BookNavigationCacheContext
attempt to achieve that by accessing the request attribute directly.
Proposed resolution
Use the proper method to access upcasted route parameter, i.e. the same code as BookBreadcrumbBuilder
.
Remaining tasks
User interface changes
API changes
Data model changes
Beta phase evaluation
Issue category | Bug |
---|---|
Issue priority | Not critical |
Comment | File | Size | Author |
---|---|---|---|
#43 | interdiff-2575827-41-43.txt | 984 bytes | msuthars |
#43 | 2575827-43.patch | 8.24 KB | msuthars |
#41 | 2575827-41.patch | 8.24 KB | paulocs |
#41 | interdiff-38-41.txt | 918 bytes | paulocs |
#38 | interdiff-2575827-33-38.txt | 2.08 KB | msuthars |
Comments
Comment #2
znerol CreditAttribution: znerol commentedComment #4
znerol CreditAttribution: znerol commentedComment #7
dawehnerLet's keep this a 8.3.x only fix, so we don't have to deal with 100% strict BC policies.
Could we not rewrite this block to use context as in block context? Then this block could be also used for usecases where the node is provided by something else in page_manager/panels. I guess this could be totally be done in a follow up.
Comment #8
alexpottI don't think #7 is really a followup - if we're changing how the block gets its book node let's get it right first time.
Comment #9
dawehnerWell, the problem with #7 is that it requires a big update path, and it will break instances of the block in page_manager we cannot update.
Comment #10
alexpott@dawehner ah ok - then a followup it is.
Comment #11
alexpottStill, the patch needs re-rolling.
Comment #12
dawehnerSure
Comment #13
hitesh-jain CreditAttribution: hitesh-jain as a volunteer commentedComment #14
hitesh-jain CreditAttribution: hitesh-jain as a volunteer commentedComment #15
hitesh-jain CreditAttribution: hitesh-jain as a volunteer commentedComment #16
hitesh-jain CreditAttribution: hitesh-jain as a volunteer commentedComment #17
hitesh-jain CreditAttribution: hitesh-jain as a volunteer commentedComment #25
mindbet CreditAttribution: mindbet as a volunteer commentedPatch updated to 9.1-dev
Comment #26
paulocsDo we need test coverage for it?
Comment #28
longwaveBookTest already has coverage for the block, as this is a refactor/bug fix I don't think we need additional coverage.
Tentatively marking RTBC. Unsure if we have to do the deprecation dance in the constructors here or not. I could only find one case in contrib and it looks like the module is using the service incorrectly anyway, as it just duplicates the existing core service twice:
https://git.drupalcode.org/project/book_blocks/-/blob/8.x.-1.x/book_bloc...
Comment #30
alexpott@longwave given thats a stable module I think we should either fix it first or account for BC here by removing the typehint and doing a deprecation dance.
Something like:
Comment #31
ayushmishra206 CreditAttribution: ayushmishra206 at OpenSense Labs commentedMade the changes suggested in #30. Please review.
Comment #32
alexpottOh we also should use the \Drupal\Core\DependencyInjection\DeprecatedServicePropertyTrait in order to provide BC for this. See \Drupal\Core\Installer\Form\SiteConfigureForm::$deprecatedProperties for an example of how that works.
@todo was a placeholder :) - see other @trigger_error's in constructors for an example of what to do. I don't think this requires a CR because the @trigger_error message will describe exactly what to do.
Comment #33
msutharsUpdated the patch as changes mentioned in #32. Please review.
Comment #34
msutharsComment #35
longwaveA word is missing here - this should read "The parameter should be an instance of..." or could just be "Pass an instance of...". The sentence should also end in a full stop.
Also, we should add a deprecation test for this.
Comment #36
msutharsComment #37
msutharsUpdated the patch as changes suggested by @longwave in #35.
Comment #38
msutharsMissed the full stop in patch #37. Updated the patch as changes suggested by @longwave in #35.
Comment #39
longwaveThanks, the message looks good now.
We will get the unused variable police on this line sooner or later, we should assert something simple about the result I think. Also the variable names should be snake_case not camelCase.
Comment #40
paulocsI'll do the fix
Comment #41
paulocsAdded changes pointed on comment #39.
Comment #42
longwave$requestStack doesn't follow our variable naming either, sorry!
Comment #43
msutharsUpdated the patch as suggested in #42.
Comment #44
longwaveThis all looks good now.
Comment #46
catchCommitted/pushed to 9.2.x, thanks!