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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

shumer created an issue. See original summary.

welly’s picture

Status: Active » Needs review
FileSize
2.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
FileSize
2.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
FileSize
4.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

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

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.

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

jibran’s picture

FileSize
1003 bytes
piggito’s picture

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

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.