Skip to content

feat: p.o.c showing how to make the toolbar extendable #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

jasonbahl
Copy link
Collaborator

@jasonbahl jasonbahl commented Feb 23, 2024

In theory, a 3rd party plugin developer could enqueue a script and call:

const MyCustomButton = () => {
  return <Button onClick={() => { alert( 'My Custom Functionality' ); }} />
}

addFilter( 'wpgraphqlide_toolbar_buttons', ( toolbarButtons ) => {

  toolbarButtons.myCustomButton => MyCustomButton
  return toolbarButtons;
} );

@jasonbahl jasonbahl added the type: enhancement Improvements to existing functionality label Feb 23, 2024
@jasonbahl jasonbahl self-assigned this Feb 23, 2024
} from '@graphiql/react';

// Assuming wp.hooks is globally available through WordPress's script enqueueing mechanism.
const { applyFilters } = wp.hooks;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use @wordpress/hooks here so that this can eventually be ran outside of WordPress and also signal to @wordpress/scripts to add this dependency to *.asset.php.

@jasonbahl jasonbahl marked this pull request as draft February 28, 2024 15:45
@josephfusco
Copy link
Member

@jasonbahl I have incorporated this POC into #60 Thanks! 🙌🏻

@josephfusco josephfusco deleted the poc/filterable-toolbar branch May 17, 2024 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement Improvements to existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants