Skip to content

Commit

Permalink
Move gutenberg-block-directory experiment check out of the action
Browse files Browse the repository at this point in the history
  • Loading branch information
gziolo committed Oct 16, 2019
1 parent 79edc4f commit 77d80f1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions lib/block-directory.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@
* @package gutenberg
*/

if ( ! has_action( 'admin_enqueue_scripts', 'enqueue_block_editor_assets_block_directory' ) ) {
if (
gutenberg_is_experiment_enabled( 'gutenberg-block-directory' ) &&
! has_action( 'admin_enqueue_scripts', 'enqueue_block_editor_assets_block_directory' )
) {
/**
* Function responsible for enqueuing the assets required
* for the block directory functionality in the editor.
*/
function gutenberg_enqueue_block_editor_assets_block_directory() {
if ( ! gutenberg_is_experiment_enabled( 'gutenberg-block-directory' ) ) {
return;
}

wp_enqueue_script( 'wp-block-directory' );
wp_enqueue_style( 'wp-block-directory' );
}
Expand Down
2 changes: 1 addition & 1 deletion lib/client-assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ function gutenberg_enqueue_block_editor_assets() {
sprintf(
'wp.apiFetch.nonceMiddleware = wp.apiFetch.createNonceMiddleware( "%s" );' .
'wp.apiFetch.use( wp.apiFetch.nonceMiddleware );' .
'wp.apiFetch.nonceEndpoint = "%s";',
'wp.apiFetch.nonceEndpoint = "%s";' .
'wp.apiFetch.use( wp.apiFetch.mediaUploadMiddleware );',
( wp_installing() && ! is_multisite() ) ? '' : wp_create_nonce( 'wp_rest' ),
admin_url( 'admin-ajax.php?action=gutenberg_rest_nonce' )
Expand Down

0 comments on commit 77d80f1

Please sign in to comment.