#56307 closed defect (bug) (fixed)
Docs: Fix parameter type of `$feature` in `block_has_support()`
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 6.1 | Priority: | normal |
Severity: | normal | Version: | 5.8 |
Component: | Editor | Keywords: | has-patch |
Focuses: | docs | Cc: |
Description
In the docs of block_has_support()
the type of $feature
is string
. See on GitHub.
It should be an array, as you see in the tests and core.
For example block_has_support( $block_type, array( 'color', 'gradient' ) );
.
Change History (8)
This ticket was mentioned in PR #3039 on WordPress/wordpress-develop by Soean.
3 years ago
#1
- Keywords has-patch added
#2
@
3 years ago
- Owner set to audrasjb
- Status changed from new to accepted
- Version set to 5.8
Good catch!
Introduced in #50761 (WP 5.8).
#3
@
3 years ago
@Soean maybe replace
Path to the specific feature to check support for.
with:
Array of paths to specific features to check support for.
What do you think?
#4
@
3 years ago
Only one $feature is checked at a time, this $feature can be nested, like for example:
block.json
{ "apiVersion": 2, ... "supports": { "spacing": { "margin": true, "padding": false } "align": false } }
$feature
:
array( 'spacing', 'margin' )
--> true
array( 'spacing', 'padding' )
--> false
Or be at the highest level, like:
array( 'align' )
--> false
So maybe? Array of path to a specific feature to check support for.
?
#5
@
3 years ago
Ok I see. Then Path to a specific feature to check support for.
looks good for me :)
3 years ago
#8
Committed in https://core.trac.wordpress.org/changeset/53799
In the docs of
block_has_support()
the type of$feature
isstring
, should bearray
.Trac ticket: https://core.trac.wordpress.org/ticket/56307