custom embed block in gutenburg editor
-
Hi everyone,
I am trying to create a custom embed for our WordPress CMS Gutenberg editor.
Here I was able to create a new variation for thecore/embed
type using thisregisterBlockVariation( WPBlockType.Embed, {
name: 'wordhub',
title: 'Word Hub',
icon: embedContentIcon,
scope: null,
description: __( 'Word Hub.', 'ink' ),
patterns: [ /^https?:\/\/(www.)*.com\/interactive\/.+/i ],
attributes: { providerNameSlug: 'wordhub', responsive: true },
} );and using the following hook to create the embed,
wp_embed_register_handler( 'wordhub', '#https?://
\/\/(www.)*.com\/interactive\/.+
*#i', __NAMESPACE__ . '\\_word_embed_handler' );(please note that sample code regex is changed due to the privacy concerns )
The question is once the embed is created and added into the editor, embed providerNameSlug is changed to ’embed-handler’.
I found the place where this is injected in the code – https://github.com/WordPress/WordPress/blob/master/wp-includes/class-wp-oembed-controller.php#L215
Could you please help me to add a custom provider_name (depending on the URL) for this embed?
Please note that this block is very unique requirement and I am not looking for workarounds, the requirement is to have a separate block in the Gutenberg editor to input the URL and embed.
Thank you very much.The page I need help with: [log in to see the link]
- The topic ‘custom embed block in gutenburg editor’ is closed to new replies.