WordPress Hooks Explorer

Listing all hooks extracted WordPress Core


Details about enqueue_block_editor_assets

Back to home

Files

Filename Hook Type Line Number PHP Doc
wp-admin/site-editor.php do_action 156 /**
* Home template resolution is not needed when block template parts are supported.
* Set the value to `true` to satisfy the editor initialization guard clause.
*/
wp-admin/edit-form-blocks.php do_action 272 /**
* Fires after block assets have been enqueued for the editing interface.
*
* Call `add_action` on any hook before 'admin_enqueue_scripts'.
*
* In the function call you supply, simply use `wp_enqueue_script` and
* `wp_enqueue_style` to add your functionality to the block editor.
*
* @since 5.0.0
*/
wp-admin/widgets-form-blocks.php do_action 65 /**
* The block-based widgets editor, for use in widgets.php.
*
* @package WordPress
* @subpackage Administration
*/
wp-includes/class-wp-customize-widgets.php do_action 879 /** This action is documented in wp-admin/admin-header.php */
do_action( 'admin_enqueue_scripts', 'widgets.php' );

/*
* Export available widgets with control_tpl removed from model
* since plugins need templates to be in the DOM.
*/
$available_widgets = array();

foreach ( $this->get_available_widgets() as $available_widget ) {
unset( $available_widget['control_tpl'] );
$available_widgets[] = $available_widget;
}

$widget_reorder_nav_tpl = sprintf(
'
%1$s%2$s%3$s
',
__( 'Move to another area…' ),
__( 'Move down' ),
__( 'Move up' )
);

$move_widget_area_tpl = str_replace(
array( '{description}', '{btn}' ),
array(
__( 'Select an area to move this widget into:' ),
_x( 'Move', 'Move widget' ),
),
'

{description}



    <% _.each( sidebars, function ( sidebar ){ %>
  • <%- sidebar.name %>

  • <% }); %>




'
);

/*
* Gather all strings in PHP that may be needed by JS on the client.
* Once JS i18n is implemented (in #20491), this can be removed.
*/
$some_non_rendered_areas_messages = array();
$some_non_rendered_areas_messages[1] = html_entity_decode(
__( 'Your theme has 1 other widget area, but this particular page does not display it.' ),
ENT_QUOTES,
get_bloginfo( 'charset' )
);
$registered_sidebar_count = count( $wp_registered_sidebars );
for ( $non_rendered_count = 2; $non_rendered_count < $registered_sidebar_count; $non_rendered_count++ ) {
$some_non_rendered_areas_messages[ $non_rendered_count ] = html_entity_decode(
sprintf(
/* translators: %s: The number of other widget areas registered but not rendered. */
_n(
'Your theme has %s other widget area, but this particular page does not display it.',
'Your theme has %s other widget areas, but this particular page does not display them.',
$non_rendered_count
),
number_format_i18n( $non_rendered_count )
),
ENT_QUOTES,
get_bloginfo( 'charset' )
);
}

if ( 1 === $registered_sidebar_count ) {
$no_areas_shown_message = html_entity_decode(
sprintf(
__( 'Your theme has 1 widget area, but this particular page does not display it.' )
),
ENT_QUOTES,
get_bloginfo( 'charset' )
);
} else {
$no_areas_shown_message = html_entity_decode(
sprintf(
/* translators: %s: The total number of widget areas registered. */
_n(
'Your theme has %s widget area, but this particular page does not display it.',
'Your theme has %s widget areas, but this particular page does not display them.',
$registered_sidebar_count
),
number_format_i18n( $registered_sidebar_count )
),
ENT_QUOTES,
get_bloginfo( 'charset' )
);
}

$settings = array(
'registeredSidebars' => array_values( $wp_registered_sidebars ),
'registeredWidgets' => $wp_registered_widgets,
'availableWidgets' => $available_widgets, // @todo Merge this with registered_widgets.
'l10n' => array(
'saveBtnLabel' => __( 'Apply' ),
'saveBtnTooltip' => __( 'Save and preview changes before publishing them.' ),
'removeBtnLabel' => __( 'Remove' ),
'removeBtnTooltip' => __( 'Keep widget settings and move it to the inactive widgets' ),
'error' => __( 'An error has occurred. Please reload the page and try again.' ),
'widgetMovedUp' => __( 'Widget moved up' ),
'widgetMovedDown' => __( 'Widget moved down' ),
'navigatePreview' => __( 'You can navigate to other pages on your site while using the Customizer to view and edit the widgets displayed on those pages.' ),
'someAreasShown' => $some_non_rendered_areas_messages,
'noAreasShown' => $no_areas_shown_message,
'reorderModeOn' => __( 'Reorder mode enabled' ),
'reorderModeOff' => __( 'Reorder mode closed' ),
'reorderLabelOn' => esc_attr__( 'Reorder widgets' ),
/* translators: %d: The number of widgets found. */
'widgetsFound' => __( 'Number of widgets found: %d' ),
'noWidgetsFound' => __( 'No widgets found.' ),
),
'tpl' => array(
'widgetReorderNav' => $widget_reorder_nav_tpl,
'moveWidgetArea' => $move_widget_area_tpl,
),
'selectiveRefreshableWidgets' => $this->get_selective_refreshable_widgets(),
);

foreach ( $settings['registeredWidgets'] as &$registered_widget ) {
unset( $registered_widget['callback'] ); // May not be JSON-serializeable.
}

$wp_scripts->add_data(
'customize-widgets',
'data',
sprintf( 'var _wpCustomizeWidgetsSettings = %s;', wp_json_encode( $settings ) )
);

/*
* TODO: Update 'wp-customize-widgets' to not rely so much on things in
* 'customize-widgets'. This will let us skip most of the above and not
* enqueue 'customize-widgets' which saves bytes.
*/

Hook Parameters

Parameter Type Name Description