wp/wp-includes/class-wp-customize-widgets.php
changeset 22 8c2e4d02f4ef
parent 21 48c4eec2b7e6
equal deleted inserted replaced
21:48c4eec2b7e6 22:8c2e4d02f4ef
   731 			),
   731 			),
   732 			'<div class="move-widget-area">
   732 			'<div class="move-widget-area">
   733 				<p class="description">{description}</p>
   733 				<p class="description">{description}</p>
   734 				<ul class="widget-area-select">
   734 				<ul class="widget-area-select">
   735 					<% _.each( sidebars, function ( sidebar ){ %>
   735 					<% _.each( sidebars, function ( sidebar ){ %>
   736 						<li class="" data-id="<%- sidebar.id %>" title="<%- sidebar.description %>" tabindex="0"><%- sidebar.name %></li>
   736 						<li class="" data-id="<%- sidebar.id %>" tabindex="0">
       
   737 							<div><strong><%- sidebar.name %></strong></div>
       
   738 							<div><%- sidebar.description %></div>
       
   739 						</li>
   737 					<% }); %>
   740 					<% }); %>
   738 				</ul>
   741 				</ul>
   739 				<div class="move-widget-actions">
   742 				<div class="move-widget-actions">
   740 					<button class="move-widget-btn button" type="button">{btn}</button>
   743 					<button class="move-widget-btn button" type="button">{btn}</button>
   741 				</div>
   744 				</div>
   863 			// Preload server-registered block schemas.
   866 			// Preload server-registered block schemas.
   864 			wp_add_inline_script(
   867 			wp_add_inline_script(
   865 				'wp-blocks',
   868 				'wp-blocks',
   866 				'wp.blocks.unstable__bootstrapServerSideBlockDefinitions(' . wp_json_encode( get_block_editor_server_block_settings() ) . ');'
   869 				'wp.blocks.unstable__bootstrapServerSideBlockDefinitions(' . wp_json_encode( get_block_editor_server_block_settings() ) . ');'
   867 			);
   870 			);
       
   871 
       
   872 			// Preload server-registered block bindings sources.
       
   873 			$registered_sources = get_all_registered_block_bindings_sources();
       
   874 			if ( ! empty( $registered_sources ) ) {
       
   875 				$filtered_sources = array();
       
   876 				foreach ( $registered_sources as $source ) {
       
   877 					$filtered_sources[] = array(
       
   878 						'name'        => $source->name,
       
   879 						'label'       => $source->label,
       
   880 						'usesContext' => $source->uses_context,
       
   881 					);
       
   882 				}
       
   883 				$script = sprintf( 'for ( const source of %s ) { wp.blocks.registerBlockBindingsSource( source ); }', wp_json_encode( $filtered_sources ) );
       
   884 				wp_add_inline_script(
       
   885 					'wp-blocks',
       
   886 					$script
       
   887 				);
       
   888 			}
   868 
   889 
   869 			wp_add_inline_script(
   890 			wp_add_inline_script(
   870 				'wp-blocks',
   891 				'wp-blocks',
   871 				sprintf( 'wp.blocks.setCategories( %s );', wp_json_encode( get_block_categories( $block_editor_context ) ) ),
   892 				sprintf( 'wp.blocks.setCategories( %s );', wp_json_encode( get_block_categories( $block_editor_context ) ) ),
   872 				'after'
   893 				'after'