-
Notifications
You must be signed in to change notification settings - Fork 566
Closed
Description
Expected Behavior:
When an oembed field type is present within a repeatable group, it should function as normal.
Actual Behavior:
The live Ajax-powered embed preview does not function, because the call to cmb2_ajax() never triggers, and thus its Ajax handlers are never registered. Ref:
Lines 1444 to 1449 in 393388b
| case 'oembed': | |
| // Initiate oembed Ajax hooks. | |
| cmb2_ajax(); | |
| break; | |
Steps to reproduce (I have confirmed I can reproduce this issue on the trunk branch):
- Register a repeatable group and place an
oembedfield type in it. - Paste an embed URL into the oEmbed URL input field.
- Observe that the live preview doesn't function. The Ajax call responds with
0because there's no registered Ajax handler for the oEmbed preview.
CMB2 Field Registration Code:
add_action( 'cmb2_init', function() {
// Meta box
$cmb_main_box = new_cmb2_box( [
'id' => 'main_box',
'title' => 'Main Content',
'object_types' => [
'post',
],
] );
// Repeatable embed group
$cmb_embed_group = $cmb_main_box->add_field( [
'id' => 'embeds',
'repeatable' => true,
'type' => 'group',
] );
// Repeatable field: embed
$cmb_main_box->add_group_field( $cmb_embed_group, [
'id' => 'url',
'name' => 'Embed URL',
'type' => 'oembed',
] );
} );Metadata
Metadata
Assignees
Labels
No labels