Problem/Motivation
In \Drupal\block_place\Plugin\DisplayVariant\PlaceBlockPageVariant::build
$destination = $this->requestStack->getCurrentRequest()->query->get('destination');
Is called in each iteration of the foreach, even though it will be the same every time.
Proposed resolution
Call the method only once outside the foreach.
Possibly it should use the redirect destination service instead of directly checking the query string.
Remaining tasks
doit
User interface changes
none
API changes
none
Data model changes
none
Will need a re-roll when #2787641: Add non-UI mechanism for setting block weight through block forms is committed, however.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 2791335-2.patch | 3.41 KB | pwolanin |
Comments
Comment #2
pwolanin commentedChanging to use the service like \Drupal\block\Controller\BlockLibraryController does
Comment #3
pwolanin commentedComment #4
yesct commentedmm. api change.
Comment #5
dawehnerGiven that the block_place module is experimental this is totally fine. IMHO this in general would be also fine in a minor version world, as the constructor is not the public interface.
Comment #6
alexpottCommitted and pushed 2acb2aa to 8.3.x and c88ad1f to 8.2.x. Thanks!
I chose to commit this to 8.2.x as well because place_block is an experimental module added in 8.2.x and improving the constructors before the release of 8.2.0 makes sense.
Fixed on commit.
Comment #9
yesct commentedComment #10
yesct commentedMade #2793053: Optimize repeated method call in BlockLibraryController and posted initial patch there.