Problem/Motivation
By doing this I'm able to do even more useful filtering when adding blocks.
Here are some suggested use cases where this would be helpful:
a) You would like to filter blocks on the delta(s). For instance, you may only add a Header block in the first section (as per example, in the test case)
b) This could also be used to ensure that you only add X number of a block to a section.
c) We would like to filter down the blocks per layout. You may only use these blocks in this layout, etc.
So, the point is that we need the Section delta, to retrieve the section to be able to adjust the blocks available to be added in that section, or apply rules given the section position.
Proposed resolution
Add delta :)
Remaining tasks
Review patch.
User interface changes
API changes
Data model changes
Comments
Comment #2
johnwebdev commentedComment #3
johnwebdev commentedComment #4
johnwebdev commentedPatch above cancelled because some obvious mistakes. Here is a new one.
It looks like:
is actually a string, and not a int. Probably something to be fixed as well, but for now I just checked it as a string.
Comment #8
tim.plunkettI'm shocked that $delta is a string!
This change fixes everything, but is invalid in PHP 5.
For now I guess we should do
$delta = (int) $delta;with a code comment of some sort.I debated when adding this hook about passing delta, but couldn't think of a use case where knowing the numeric delta would actually help.
Can you expand the Issue Summary to better explain the use case?
Comment #9
johnwebdev commentedComment #10
johnwebdev commentedComment #11
johnwebdev commentedForgot interdiff. I also updated IS with some use cases.
Comment #13
johnwebdev commentedComment #14
johnzzonLine exceeds 80 chars.
Missing space at start of comment.
Other than that, this patch looks great! Works perfectly to allow me to filter the available blocks in my layouts.
Comment #15
johnwebdev commentedAdressed feedback in #14.
Comment #16
tim.plunkettI still can't personally envision using the specific delta, especially for anything other than $delta===0.
But there's nothing wrong with adding this, and if it's useful for others, might as well!
Explicitly is misspelled. Can we get an @todo for an issue to remove this cast?
Comment #17
johnwebdev commentedComment #18
johnwebdev commentedComment #19
johnwebdev commentedComment #20
tim.plunkettLooks great, just a minor doc nit
Can you rewrite this to:
(note the lowercase todo, the indent for the second line, and the trailing period)
Extra blank line
Comment #21
tim.plunkettSince these were minor changes, doing it myself and RTBCing.
Comment #22
alexpottCommitted 0c3ea72 and pushed to 8.6.x. Thanks!
Comment #25
jdleonardThe patch committed only partially resolved this issue (it addressed non-inline blocks, but did not address inline blocks). I have provided a follow-up patch in #3038981: Inline blocks missing section delta extra data on filtered block definitions
Comment #26
tim.plunkettRetroactively tagging