Ticket #47620: 47620-context-2.diff
File 47620-context-2.diff, 2.8 KB (added by , 5 years ago) |
---|
-
src/wp-admin/includes/post.php
2234 2234 function get_block_editor_server_block_settings() { 2235 2235 $block_registry = WP_Block_Type_Registry::get_instance(); 2236 2236 $blocks = array(); 2237 $keys_to_pick = array( 'title', 'description', 'icon', 'category', 'keywords', 'parent', 'supports', 'attributes', 'styles', 'textdomain', 'example' ); 2237 $fields_to_pick = array( 2238 'title' => 'title', 2239 'description' => 'description', 2240 'icon' => 'icon', 2241 'category' => 'category', 2242 'keywords' => 'keywords', 2243 'parent' => 'parent', 2244 'supports' => 'supports', 2245 'attributes' => 'attributes', 2246 'provides_context' => 'providesContext', 2247 'uses_context' => 'usesContext', 2248 'styles' => 'styles', 2249 'textdomain' => 'textdomain', 2250 'example' => 'example', 2251 ); 2238 2252 2239 2253 foreach ( $block_registry->get_all_registered() as $block_name => $block_type ) { 2240 foreach ( $ keys_to_pick as$key ) {2241 if ( ! isset( $block_type->{ $ key} ) ) {2254 foreach ( $fields_to_pick as $field => $key ) { 2255 if ( ! isset( $block_type->{ $field } ) ) { 2242 2256 continue; 2243 2257 } 2244 2258 … … 2246 2260 $blocks[ $block_name ] = array(); 2247 2261 } 2248 2262 2249 $blocks[ $block_name ][ $key ] = $block_type->{ $ key};2263 $blocks[ $block_name ][ $key ] = $block_type->{ $field }; 2250 2264 } 2251 2265 } 2252 2266 -
src/wp-includes/class-wp-block-type.php
74 74 75 75 /** 76 76 * @since 5.5.0 77 * @var array 77 * @var array|null 78 78 */ 79 public $supports = array();79 public $supports = null; 80 80 81 81 /** 82 82 * @since 5.5.0 … … 101 101 public $attributes = null; 102 102 103 103 /** 104 * Context values inherited by blocks of this type. 105 * 106 * @since 5.5.0 107 * @var array 108 */ 109 public $uses_context = array(); 110 111 /** 112 * Context provided by blocks of this type. 113 * 114 * @since 5.5.0 115 * @var array|null 116 */ 117 public $provides_context = null; 118 119 /** 104 120 * Block type editor script handle. 105 121 * 106 122 * @since 5.0.0 -
tests/phpunit/tests/admin/includesPost.php
844 844 'category' => 'common', 845 845 'icon' => 'text', 846 846 'keywords' => array(), 847 ' supports'=> array(),847 'usesContext' => array(), 848 848 'styles' => array(), 849 849 ), 850 850 $blocks[ $name ]