Changeset 57521
- Timestamp:
- 02/02/2024 12:59:21 PM (15 months ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/post.php
r57239 r57521 2304 2304 'example' => 'example', 2305 2305 'variations' => 'variations', 2306 'allowed_blocks' => 'allowedBlocks', 2306 2307 ); 2307 2308 -
trunk/src/wp-includes/blocks.php
r57493 r57521 328 328 * @since 6.3.0 Added `selectors` field. 329 329 * @since 6.4.0 Added support for `blockHooks` field. 330 * @since 6.5.0 Added support for ` viewStyle` field.330 * @since 6.5.0 Added support for `allowedBlocks` and `viewStyle` fields. 331 331 * 332 332 * @param string $file_or_folder Path to the JSON file with metadata definition for … … 425 425 'variations' => 'variations', 426 426 'example' => 'example', 427 'allowedBlocks' => 'allowed_blocks', 427 428 ); 428 429 $textdomain = ! empty( $metadata['textdomain'] ) ? $metadata['textdomain'] : null; -
trunk/src/wp-includes/class-wp-block-type.php
r57493 r57521 68 68 */ 69 69 public $ancestor = null; 70 71 /** 72 * Limits which block types can be inserted as children of this block type. 73 * 74 * @since 6.5.0 75 * @var string[]|null 76 */ 77 public $allowed_blocks = null; 70 78 71 79 /** … … 304 312 * @type string[]|null $ancestor Setting ancestor makes a block available only inside the specified 305 313 * block types at any position of the ancestor's block subtree. 314 * @type string[]|null $allowed_blocks Limits which block types can be inserted as children of this block type. 306 315 * @type string|null $icon Block type icon. 307 316 * @type string $description A detailed block type description. -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-block-types-controller.php
r57493 r57521 281 281 'parent', 282 282 'ancestor', 283 'allowed_blocks', 283 284 'provides_context', 284 285 'uses_context', … … 724 725 'readonly' => true, 725 726 ), 727 'allowed_blocks' => array( 728 'description' => __( 'Allowed child block types.' ), 729 'type' => array( 'array', 'null' ), 730 'items' => array( 731 'type' => 'string', 732 'pattern' => self::NAME_PATTERN, 733 ), 734 'default' => null, 735 'context' => array( 'embed', 'view', 'edit' ), 736 'readonly' => true, 737 ), 726 738 'keywords' => $keywords_definition, 727 739 'example' => $example_definition, -
trunk/tests/phpunit/tests/rest-api/rest-block-type-controller.php
r57493 r57521 208 208 'parent' => 'invalid_parent', 209 209 'ancestor' => 'invalid_ancestor', 210 'allowed_blocks' => 'invalid_allowed_blocks', 210 211 'icon' => true, 211 212 'description' => true, … … 238 239 $this->assertSameSets( array( 'invalid_parent' ), $data['parent'] ); 239 240 $this->assertSameSets( array( 'invalid_ancestor' ), $data['ancestor'] ); 241 $this->assertSameSets( array( 'invalid_allowed_blocks' ), $data['allowed_blocks'] ); 240 242 $this->assertNull( $data['icon'] ); 241 243 $this->assertSame( '1', $data['description'] ); … … 284 286 'parent' => false, 285 287 'ancestor' => false, 288 'allowed_blocks' => false, 286 289 'icon' => false, 287 290 'description' => false, … … 314 317 $this->assertSameSets( array(), $data['parent'] ); 315 318 $this->assertSameSets( array(), $data['ancestor'] ); 319 $this->assertSameSets( array(), $data['allowed_blocks'] ); 316 320 $this->assertNull( $data['icon'] ); 317 321 $this->assertSame( '', $data['description'] ); … … 551 555 * @ticket 57585 552 556 * @ticket 59346 557 * @ticket 60403 553 558 */ 554 559 public function test_get_item_schema() { … … 558 563 $data = $response->get_data(); 559 564 $properties = $data['schema']['properties']; 560 $this->assertCount( 3 1, $properties );565 $this->assertCount( 32, $properties ); 561 566 $this->assertArrayHasKey( 'api_version', $properties ); 562 567 $this->assertArrayHasKey( 'name', $properties ); … … 565 570 $this->assertArrayHasKey( 'parent', $properties ); 566 571 $this->assertArrayHasKey( 'ancestor', $properties ); 572 $this->assertArrayHasKey( 'allowed_blocks', $properties ); 567 573 $this->assertArrayHasKey( 'icon', $properties ); 568 574 $this->assertArrayHasKey( 'description', $properties ); … … 697 703 'parent', 698 704 'ancestor', 705 'allowedBlocks', 699 706 'icon', 700 707 'description',
Note: See TracChangeset
for help on using the changeset viewer.