Hello,
currently there is no possibility to alter build array of block which renders through Panels module. In PanelsDisplayVariant.php we have a method buildRegions which render available blocks, so it would be very useful to get hook_alter similar to BlockViewBuilder so other modules will have a way to affect on block build array.

Comments

shumer created an issue. See original summary.

welly’s picture

Status: Active » Needs review
StatusFileSize
new2.64 KB

I needed this very thing this morning on a project. Together with jibran, we've come up with a patch. Can we get a review?

jibran’s picture

Status: Needs review » Needs work

The last submitted patch, 2: edit_alter_block_during-2559533-1.patch, failed testing.

welly’s picture

Status: Needs work » Needs review
StatusFileSize
new2.5 KB

Fixed patch

Status: Needs review » Needs work

The last submitted patch, 5: alter_block_during-2559533-5.patch, failed testing.

welly’s picture

Status: Needs work » Needs review
StatusFileSize
new4.52 KB

Patch updated to inject dependency into InPlaceEditorDisplayBuilder class

Status: Needs review » Needs work

The last submitted patch, 7: alter_block_during-2559533-7.patch, failed testing.

welly’s picture

StatusFileSize
new4.49 KB

Let's try again.

welly’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 9: alter_block_during-2559533-9.patch, failed testing.

welly’s picture

StatusFileSize
new5.55 KB

Fixed failed test (hopefully)

welly’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 12: alter_block_during-2559533-12.patch, failed testing.

jibran’s picture

Version: 8.x-3.x-dev » 8.x-4.x-dev
Status: Needs work » Needs review
StatusFileSize
new5.55 KB
new5.59 KB

The last submitted patch, 15: alter_block_during-2559533-15.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 15: alter_block_during-2559533-15-4.x.patch, failed testing.

jibran’s picture

Status: Needs work » Needs review
StatusFileSize
new5.54 KB
new5.58 KB
jibran’s picture

StatusFileSize
new1003 bytes
piggito’s picture

StatusFileSize
new6.16 KB
new862 bytes

I'm adding a patch to include hook_block_build_alter too.

The last submitted patch, 20: alter_block_during-2559533-20.patch, failed testing. View results

piggito’s picture

StatusFileSize
new6.15 KB
new975 bytes

I made a mistake in my last patch, I'm adding the correct one.

andyf’s picture

Title: Alter block during render process. » Support hook_block_build_alter() and hook_block_view_alter()
jibran’s picture

Category: Feature request » Task
Status: Needs review » Reviewed & tested by the community

I don't think it is a feature request and it's not a bug it is just a missing functionality so I changed it to a task. Core has hook specific tests to verify the implementation is working correctly but I have not seen this practice in contrib so I think with a green patch it is RTBC.

samuel.mortenson’s picture

Status: Reviewed & tested by the community » Fixed

This makes a lot of sense, and doesn't seem to interfere with my existing Panels sites. Thank all!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.