[wp-trac] [WordPress Trac] #62090: Editor: Add filter for supported block binding attributes
WordPress Trac
noreply at wordpress.org
Wed Feb 12 14:54:46 UTC 2025
#62090: Editor: Add filter for supported block binding attributes
--------------------------------------------------+---------------------
Reporter: maxschmeling | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: 6.8
Component: Editor | Version: 6.5
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests 2nd-opinion | Focuses:
--------------------------------------------------+---------------------
Comment (by gziolo):
I took another look at this ticket, and I concluded that we could
introduce a way to filter the way the block attributes are accepted for
processing with Block Bindings. I would be in favor of using a slightly
modified approach which is closer to the existing filter that allows
changing the return value computed for the specific source:
[https://developer.wordpress.org/reference/hooks/block_bindings_source_value/
block_bindings_source_value]
The definition looks as follows:
{{{#!php
apply_filters( 'block_bindings_source_value', mixed $value, string $name,
array $source_args, WP_Block $block_instance, string $attribute_name )
}}}
In the case of the decision process for the individual attributes on
whether they should be processed when connected through Block Bindings, we
could have something similar in place, example:
{{{#!php
apply_filters( 'block_bindings_supported_attribute', boolean $supported,
WP_Block $block_instance, string $attribute_name )
}}}
It would definitely require some refactoring in the patch proposed, but I
personally like the flexibility it offers while keeping the simple API
where the filtered value has a boolean type in contrast to the current
proposal where the array would have to be extended with every possible
block type and attribute names.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/62090#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list