wp/wp-includes/blocks/query.php
changeset 22 8c2e4d02f4ef
parent 21 48c4eec2b7e6
equal deleted inserted replaced
21:48c4eec2b7e6 22:8c2e4d02f4ef
    22 		&& isset( $attributes['queryId'] );
    22 		&& isset( $attributes['queryId'] );
    23 
    23 
    24 	// Enqueue the script module and add the necessary directives if the block is
    24 	// Enqueue the script module and add the necessary directives if the block is
    25 	// interactive.
    25 	// interactive.
    26 	if ( $is_interactive ) {
    26 	if ( $is_interactive ) {
    27 		$suffix = wp_scripts_get_suffix();
    27 		wp_enqueue_script_module( '@wordpress/block-library/query/view' );
    28 		if ( defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN ) {
       
    29 			$module_url = gutenberg_url( '/build/interactivity/query.min.js' );
       
    30 		}
       
    31 
       
    32 		wp_register_script_module(
       
    33 			'@wordpress/block-library/query',
       
    34 			isset( $module_url ) ? $module_url : includes_url( "blocks/query/view{$suffix}.js" ),
       
    35 			array(
       
    36 				array(
       
    37 					'id'     => '@wordpress/interactivity',
       
    38 					'import' => 'static',
       
    39 				),
       
    40 				array(
       
    41 					'id'     => '@wordpress/interactivity-router',
       
    42 					'import' => 'dynamic',
       
    43 				),
       
    44 			),
       
    45 			defined( 'GUTENBERG_VERSION' ) ? GUTENBERG_VERSION : get_bloginfo( 'version' )
       
    46 		);
       
    47 		wp_enqueue_script_module( '@wordpress/block-library/query' );
       
    48 
    28 
    49 		$p = new WP_HTML_Tag_Processor( $content );
    29 		$p = new WP_HTML_Tag_Processor( $content );
    50 		if ( $p->next_tag() ) {
    30 		if ( $p->next_tag() ) {
    51 			// Add the necessary directives.
    31 			// Add the necessary directives.
    52 			$p->set_attribute( 'data-wp-interactive', 'core/query' );
    32 			$p->set_attribute( 'data-wp-interactive', 'core/query' );
    97  * disabled to prevent any potential incompatibilities.
    77  * disabled to prevent any potential incompatibilities.
    98  *
    78  *
    99  * @since 6.4.0
    79  * @since 6.4.0
   100  *
    80  *
   101  * @param array $parsed_block The block being rendered.
    81  * @param array $parsed_block The block being rendered.
   102  * @return string Returns the parsed block, unmodified.
    82  * @return array Returns the parsed block, unmodified.
   103  */
    83  */
   104 function block_core_query_disable_enhanced_pagination( $parsed_block ) {
    84 function block_core_query_disable_enhanced_pagination( $parsed_block ) {
   105 	static $enhanced_query_stack   = array();
    85 	static $enhanced_query_stack   = array();
   106 	static $dirty_enhanced_queries = array();
    86 	static $dirty_enhanced_queries = array();
   107 	static $render_query_callback  = null;
    87 	static $render_query_callback  = null;