Skip to content
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

Added hook to allow extending of gutenberg editor in plugin/themes. #1186

Closed
wants to merge 1 commit into from

Conversation

selul
Copy link

@selul selul commented Jun 15, 2017

Ref: #1184

/**
* Hook to allow extending of gutenberg editor in plugin/themes.
*/
do_action( 'block_enqueue_script', $hook_suffix );
Copy link
Member

@westonruter westonruter Jun 15, 2017

Choose a reason for hiding this comment

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

The hook name should be plural, so block_enqueue_scripts.

Copy link
Member

Choose a reason for hiding this comment

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

Also, I think this should actually be block_edit_enqueue_scripts to make it clear that the scripts and styles being enqueued are for the editor and not for blocks that are being rendered on the frontend.

Copy link
Contributor

Choose a reason for hiding this comment

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

I personal prefer block_enqueue_scripts. I'm guessing the frontend scripts and styles won't be enqueued using actions like this, but more with something tied to the block API.

/**
* Hook to allow extending of gutenberg editor in plugin/themes.
*/
do_action( 'block_enqueue_script', $hook_suffix );
Copy link
Member

Choose a reason for hiding this comment

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

Is $hook_suffix needed?

Copy link
Author

Choose a reason for hiding this comment

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

@westonruter i tried to replicate the admin_enqueue_script behaviour, which passes the $hook_sufix when calling the action.

@gziolo gziolo added the [Feature] Extensibility The ability to extend blocks or the editing experience label Jan 27, 2018
@gziolo
Copy link
Member

gziolo commented Jan 27, 2018

It was implemented and iterated a few times. You can see the latest docs here: https://github.com/WordPress/gutenberg/blob/master/docs/blocks-basic.md#enqueuing-block-scripts. I'm closing this PR, feel free to open another PR if you feel like we need more flexibility there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Extensibility The ability to extend blocks or the editing experience
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants