Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
12f355e
Initial commit. Add meta field to post types.
cbravobernal Sep 17, 2024
9ba93b0
Add post meta
cbravobernal Sep 17, 2024
364dc27
Add todos
cbravobernal Sep 17, 2024
d3491d6
Add fields in all postType
SantosGuillamot Sep 17, 2024
19cb1f9
WIP: Add first version to link templates and entities
SantosGuillamot Sep 17, 2024
1e8c3bf
Revert "WIP: Add first version to link templates and entities"
SantosGuillamot Sep 17, 2024
f8f18fc
Only expose public fields
SantosGuillamot Sep 17, 2024
82006cf
Add subtype to meta properties
SantosGuillamot Sep 17, 2024
ae6037e
Render the appropriate fields depending on the postType in templates
SantosGuillamot Sep 17, 2024
faa713f
Use context postType when available
SantosGuillamot Sep 17, 2024
8706071
Fetch the data on render, preventing one click needed
cbravobernal Sep 17, 2024
7593629
Yoda conditions..
cbravobernal Sep 17, 2024
6758ec1
Try: Expose registered meta fields in schema
SantosGuillamot Sep 17, 2024
35127e0
Try: Create a resolver to get registered post meta
SantosGuillamot Sep 17, 2024
ef6c64b
Use rest namespace
cbravobernal Sep 17, 2024
0330ddf
Move actions and selectors to private.
cbravobernal Sep 17, 2024
53ac96d
Merge useSelect
cbravobernal Sep 17, 2024
c41877b
Fix duplicated
cbravobernal Sep 17, 2024
bf7ab98
Add object_subtype to schema
SantosGuillamot Sep 17, 2024
da336be
Update docs to object_subtype
cbravobernal Sep 17, 2024
0734e02
Add explanatory comment
cbravobernal Sep 17, 2024
d76d0a4
Block Bindings: Use default values in connected custom fields in temp…
SantosGuillamot Sep 17, 2024
ca45424
Try removing all object subtype
cbravobernal Sep 17, 2024
b911680
Fix e2e
cbravobernal Sep 17, 2024
44048d7
Update code
cbravobernal Sep 17, 2024
17e0bd6
Fix `useSelect` warning
SantosGuillamot Sep 17, 2024
1d33103
Remove old comment
SantosGuillamot Sep 17, 2024
e17fde7
Remove support for generic templates
SantosGuillamot Sep 17, 2024
782a123
Revert changes to e2e tests
SantosGuillamot Sep 17, 2024
344cbf7
Change the value returned by `getFieldsList` to include label
SantosGuillamot Sep 17, 2024
4914c8f
Use label in bindings panel
SantosGuillamot Sep 17, 2024
780ae67
Use label in rich text placeholders
SantosGuillamot Sep 17, 2024
a23dd37
Add filter to include `label`
SantosGuillamot Sep 17, 2024
a4436b0
Use title instead of label in schema
SantosGuillamot Sep 17, 2024
d5eb220
Add safety check
SantosGuillamot Sep 17, 2024
0a92891
Adapt branch after rebase
SantosGuillamot Sep 17, 2024
0a0ee3f
Remove extra spaces
SantosGuillamot Sep 17, 2024
f089676
Don't rely on key outside of post meta
SantosGuillamot Sep 17, 2024
6288d34
Remove key from bindings component
SantosGuillamot Sep 17, 2024
efa3b5d
Read title instead of label
SantosGuillamot Sep 17, 2024
23908f7
Add backport to changelog
SantosGuillamot Sep 17, 2024
d724026
Update translator comment
SantosGuillamot Sep 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add filter to include label
  • Loading branch information
SantosGuillamot committed Sep 17, 2024
commit a23dd37f284dd34eadf55175c6b99129eadc28b7
28 changes: 28 additions & 0 deletions lib/compat/wordpress-6.7/block-bindings.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,31 @@ function gutenberg_add_can_update_block_bindings_editor_setting( $editor_setting
}

add_filter( 'block_editor_settings_all', 'gutenberg_add_can_update_block_bindings_editor_setting', 10 );

/**
* Add `label` to `register_meta`.
*
* @param array $args Array of arguments for registering meta.
* @return array Modified arguments array including `label`.
*/
function gutenberg_update_meta_args_with_label( $args ) {
// Default to empty string.
$schema = array( 'title' => isset( $args['label'] ) ? $args['label'] : '' );
if ( ! is_array( $args['show_in_rest'] ) ) {
$args['show_in_rest'] = array(
'schema' => $schema,
);
return $args;
}

if ( ! empty( $args['show_in_rest']['schema'] ) ) {
$args['show_in_rest']['schema'] = array_merge( $args['show_in_rest']['schema'], $schema );
} else {
$args['show_in_rest']['schema'] = $schema;
}

return $args;
}

// Priority must be lower than 10 to ensure the label is not removed.
add_filter( 'register_meta_args', 'gutenberg_update_meta_args_with_label', 5, 1 );