Changeset 54155 for trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-block-types-controller.php
- Timestamp:
- 09/14/2022 10:50:26 AM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-block-types-controller.php
r53760 r54155 257 257 } 258 258 259 $schema = $this->get_item_schema(); 260 $extra_fields = array( 261 'api_version', 262 'name', 263 'title', 264 'description', 265 'icon', 266 'category', 267 'keywords', 268 'parent', 269 'ancestor', 270 'provides_context', 271 'uses_context', 272 'supports', 273 'styles', 274 'textdomain', 275 'example', 259 $schema = $this->get_item_schema(); 260 // Fields deprecated in WordPress 6.1, but left in the schema for backwards compatibility. 261 $deprecated_fields = array( 276 262 'editor_script', 277 263 'script', … … 279 265 'editor_style', 280 266 'style', 281 'variations', 267 ); 268 $extra_fields = array_merge( 269 array( 270 'api_version', 271 'name', 272 'title', 273 'description', 274 'icon', 275 'category', 276 'keywords', 277 'parent', 278 'ancestor', 279 'provides_context', 280 'uses_context', 281 'supports', 282 'styles', 283 'textdomain', 284 'example', 285 'editor_script_handles', 286 'script_handles', 287 'view_script_handles', 288 'editor_style_handles', 289 'style_handles', 290 'variations', 291 ), 292 $deprecated_fields 282 293 ); 283 294 foreach ( $extra_fields as $extra_field ) { … … 438 449 ); 439 450 440 $ schema = array(451 $this->schema = array( 441 452 '$schema' => 'http://json-schema.org/draft-04/schema#', 442 453 'title' => 'block-type', 443 454 'type' => 'object', 444 455 'properties' => array( 445 'api_version' => array(456 'api_version' => array( 446 457 'description' => __( 'Version of block API.' ), 447 458 'type' => 'integer', … … 450 461 'readonly' => true, 451 462 ), 452 'title' => array(463 'title' => array( 453 464 'description' => __( 'Title of block type.' ), 454 465 'type' => 'string', … … 457 468 'readonly' => true, 458 469 ), 459 'name' => array(470 'name' => array( 460 471 'description' => __( 'Unique name identifying the block type.' ), 461 472 'type' => 'string', … … 464 475 'readonly' => true, 465 476 ), 466 'description' => array(477 'description' => array( 467 478 'description' => __( 'Description of block type.' ), 468 479 'type' => 'string', … … 471 482 'readonly' => true, 472 483 ), 473 'icon' => $icon_definition,474 'attributes' => array(484 'icon' => $icon_definition, 485 'attributes' => array( 475 486 'description' => __( 'Block attributes.' ), 476 487 'type' => array( 'object', 'null' ), … … 483 494 'readonly' => true, 484 495 ), 485 'provides_context' => array(496 'provides_context' => array( 486 497 'description' => __( 'Context provided by blocks of this type.' ), 487 498 'type' => 'object', … … 494 505 'readonly' => true, 495 506 ), 496 'uses_context' => array(507 'uses_context' => array( 497 508 'description' => __( 'Context values inherited by blocks of this type.' ), 498 509 'type' => 'array', … … 504 515 'readonly' => true, 505 516 ), 506 'supports' => array(517 'supports' => array( 507 518 'description' => __( 'Block supports.' ), 508 519 'type' => 'object', … … 512 523 'readonly' => true, 513 524 ), 514 'category' => $category_definition,515 'is_dynamic' => array(525 'category' => $category_definition, 526 'is_dynamic' => array( 516 527 'description' => __( 'Is the block dynamically rendered.' ), 517 528 'type' => 'boolean', … … 520 531 'readonly' => true, 521 532 ), 522 'editor_script' => array( 523 'description' => __( 'Editor script handle.' ), 524 'type' => array( 'string', 'null' ), 525 'default' => null, 526 'context' => array( 'embed', 'view', 'edit' ), 527 'readonly' => true, 528 ), 529 'script' => array( 530 'description' => __( 'Public facing and editor script handle.' ), 531 'type' => array( 'string', 'null' ), 532 'default' => null, 533 'context' => array( 'embed', 'view', 'edit' ), 534 'readonly' => true, 535 ), 536 'view_script' => array( 537 'description' => __( 'Public facing script handle.' ), 538 'type' => array( 'string', 'null' ), 539 'default' => null, 540 'context' => array( 'embed', 'view', 'edit' ), 541 'readonly' => true, 542 ), 543 'editor_style' => array( 544 'description' => __( 'Editor style handle.' ), 545 'type' => array( 'string', 'null' ), 546 'default' => null, 547 'context' => array( 'embed', 'view', 'edit' ), 548 'readonly' => true, 549 ), 550 'style' => array( 551 'description' => __( 'Public facing and editor style handle.' ), 552 'type' => array( 'string', 'null' ), 553 'default' => null, 554 'context' => array( 'embed', 'view', 'edit' ), 555 'readonly' => true, 556 ), 557 'styles' => array( 533 'editor_script_handles' => array( 534 'description' => __( 'Editor script handles.' ), 535 'type' => array( 'array' ), 536 'default' => array(), 537 'items' => array( 538 'type' => 'string', 539 ), 540 'context' => array( 'embed', 'view', 'edit' ), 541 'readonly' => true, 542 ), 543 'script_handles' => array( 544 'description' => __( 'Public facing and editor script handles.' ), 545 'type' => array( 'array' ), 546 'default' => array(), 547 'items' => array( 548 'type' => 'string', 549 ), 550 'context' => array( 'embed', 'view', 'edit' ), 551 'readonly' => true, 552 ), 553 'view_script_handles' => array( 554 'description' => __( 'Public facing script handles.' ), 555 'type' => array( 'array' ), 556 'default' => array(), 557 'items' => array( 558 'type' => 'string', 559 ), 560 'context' => array( 'embed', 'view', 'edit' ), 561 'readonly' => true, 562 ), 563 'editor_style_handles' => array( 564 'description' => __( 'Editor style handles.' ), 565 'type' => array( 'array' ), 566 'default' => array(), 567 'items' => array( 568 'type' => 'string', 569 ), 570 'context' => array( 'embed', 'view', 'edit' ), 571 'readonly' => true, 572 ), 573 'style_handles' => array( 574 'description' => __( 'Public facing and editor style handles.' ), 575 'type' => array( 'array' ), 576 'default' => array(), 577 'items' => array( 578 'type' => 'string', 579 ), 580 'context' => array( 'embed', 'view', 'edit' ), 581 'readonly' => true, 582 ), 583 'styles' => array( 558 584 'description' => __( 'Block style variations.' ), 559 585 'type' => 'array', … … 584 610 'readonly' => true, 585 611 ), 586 'variations' => array(612 'variations' => array( 587 613 'description' => __( 'Block variations.' ), 588 614 'type' => 'array', … … 636 662 'default' => null, 637 663 ), 638 'textdomain' => array(664 'textdomain' => array( 639 665 'description' => __( 'Public text domain.' ), 640 666 'type' => array( 'string', 'null' ), … … 643 669 'readonly' => true, 644 670 ), 645 'parent' => array(671 'parent' => array( 646 672 'description' => __( 'Parent blocks.' ), 647 673 'type' => array( 'array', 'null' ), … … 653 679 'readonly' => true, 654 680 ), 655 'ancestor' => array(681 'ancestor' => array( 656 682 'description' => __( 'Ancestor blocks.' ), 657 683 'type' => array( 'array', 'null' ), … … 668 694 ); 669 695 670 $this->schema = $schema; 696 // Properties deprecated in WordPress 6.1, but left in the schema for backwards compatibility. 697 $deprecated_properties = array( 698 'editor_script' => array( 699 'description' => __( 'Editor script handle. DEPRECATED: Use `editor_script_handles` instead.' ), 700 'type' => array( 'string', 'null' ), 701 'default' => null, 702 'context' => array( 'embed', 'view', 'edit' ), 703 'readonly' => true, 704 ), 705 'script' => array( 706 'description' => __( 'Public facing and editor script handle. DEPRECATED: Use `script_handles` instead.' ), 707 'type' => array( 'string', 'null' ), 708 'default' => null, 709 'context' => array( 'embed', 'view', 'edit' ), 710 'readonly' => true, 711 ), 712 'view_script' => array( 713 'description' => __( 'Public facing script handle. DEPRECATED: Use `view_script_handles` instead.' ), 714 'type' => array( 'string', 'null' ), 715 'default' => null, 716 'context' => array( 'embed', 'view', 'edit' ), 717 'readonly' => true, 718 ), 719 'editor_style' => array( 720 'description' => __( 'Editor style handle. DEPRECATED: Use `editor_style_handles` instead.' ), 721 'type' => array( 'string', 'null' ), 722 'default' => null, 723 'context' => array( 'embed', 'view', 'edit' ), 724 'readonly' => true, 725 ), 726 'style' => array( 727 'description' => __( 'Public facing and editor style handle. DEPRECATED: Use `style_handles` instead.' ), 728 'type' => array( 'string', 'null' ), 729 'default' => null, 730 'context' => array( 'embed', 'view', 'edit' ), 731 'readonly' => true, 732 ), 733 ); 734 $this->schema['properties'] = array_merge( $this->schema['properties'], $deprecated_properties ); 671 735 672 736 return $this->add_additional_fields_schema( $this->schema );
Note: See TracChangeset
for help on using the changeset viewer.