[wp-trac] [WordPress Trac] #46187: Add a dynamic hook to filter the content of a single block.

WordPress Trac noreply at wordpress.org
Tue Feb 5 12:18:24 UTC 2019


#46187: Add a dynamic hook to filter the content of a single block.
----------------------------+------------------------------
 Reporter:  manzoorwani.jk  |       Owner:  (none)
     Type:  enhancement     |      Status:  new
 Priority:  normal          |   Milestone:  Awaiting Review
Component:  Editor          |     Version:
 Severity:  normal          |  Resolution:
 Keywords:  has-patch       |     Focuses:
----------------------------+------------------------------
Changes (by birgire):

 * keywords:   => has-patch


Comment:

 Thanks for the ticket @manzoorwanijk

 At a first glance this sounds useful.

 Using a dynamic filter, we should make sure that the block names can't
 contain characters that are not supported as filter names.

 Few questions come to mind: What limitations are on the block names and
 filter names? For example what is the maximum length of filter names and
 block names? Is it the same?

 Regarding the if-condition in [attachment:"46187.diff"], should e.g. "0"
 be allowed, that is if "0" is a possible block name?

 If this goes through, then it would need a {{{@since x.y.z}}} for the the
 filter documentation.

 There seems to be some code standard adjustments needed in
 [attachment:"46187.diff"] :

 - I think the variable assigning within the if-condition is not
 recommended.
 - Missing end of line periods in inline documentation.
 - Fix indentation.
 - First word in inline documentation not capitalized.

 Should the specific dynamic filter come before or after the existing and
 more general {{{render_block}}} filter? I didn't find quickly some good
 existing core examples for the case of filters, but we have e.g. the
 dynamic action {{{"save_post_{$post->post_type}"}}} running before
 {{{"save_post"}}}. In that case the more specific comes before the general
 one. This is the same order as in [attachment:"46187.diff"].

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/46187#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list