-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Conversation
/** | ||
* Hook to allow extending of gutenberg editor in plugin/themes. | ||
*/ | ||
do_action( 'block_enqueue_script', $hook_suffix ); |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is $hook_suffix
needed?
There was a problem hiding this comment.
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.
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. |
Ref: #1184