Set Button in PluginDocumentSettingPanel Content (WordPress Gutenberg)

I finally solved it like this: var registerPlugin = wp.plugins.registerPlugin; var PluginDocumentSettingPanel = wp.editPost.PluginDocumentSettingPanel; var Button = wp.components.Button; var el = wp.element.createElement; var __ = wp.i18n.__; function onButtonClick() { alert( ‘Button is clicked’ ); } function MyDocumentSettingPlugin() { return el( PluginDocumentSettingPanel, { name: ‘my-document-setting-plugin’, title: ‘My Panel’, icon: ‘dashicon-name’, }, __( ‘My Document Setting Panel … Read more

Proxy External API request in PHP from Edit.js in Block Plugin

Okay, I figured it out! First, I created a rest endpoint in PHP. https://github.com/bbuilds/ih-top-nurses-block/blob/main/inc/rest.php#L11 The rest point has optional parameters using regex and then in the register_rest_route() callback builds a fetch URL depending on the parameters passed to the WP-REST endpoint. It then fires to the external API wp_remote_get($fetch_url) and dumps the data into the … Read more