Changeset 58230
- Timestamp:
- 05/29/2024 08:51:04 AM (5 months ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/option.php
r58182 r58230 2660 2660 ), 2661 2661 'type' => 'string', 2662 'label' => __( 'Title' ), 2662 2663 'description' => __( 'Site title.' ), 2663 2664 ) … … 2672 2673 ), 2673 2674 'type' => 'string', 2675 'label' => __( 'Tagline' ), 2674 2676 'description' => __( 'Site tagline.' ), 2675 2677 ) … … 2802 2804 'show_in_rest' => true, 2803 2805 'type' => 'integer', 2806 'label' => __( 'Maximum posts per page' ), 2804 2807 'description' => __( 'Blog pages show at most.' ), 2805 2808 'default' => 10, … … 2813 2816 'show_in_rest' => true, 2814 2817 'type' => 'string', 2818 'label' => __( 'Show on front' ), 2815 2819 'description' => __( 'What to show on the front page' ), 2816 2820 ) … … 2823 2827 'show_in_rest' => true, 2824 2828 'type' => 'integer', 2829 'label' => __( 'Page on front' ), 2825 2830 'description' => __( 'The ID of the page that should be displayed on the front page' ), 2826 2831 ) … … 2861 2866 ), 2862 2867 'type' => 'string', 2868 'label' => __( 'Allow comments on new posts' ), 2863 2869 'description' => __( 'Allow people to submit comments on new posts.' ), 2864 2870 ) … … 2875 2881 * @since 5.5.0 `$new_whitelist_options` was renamed to `$new_allowed_options`. 2876 2882 * Please consider writing more inclusive code. 2883 * @since 6.6.0 Added the `label` argument. 2877 2884 * 2878 2885 * @global array $new_allowed_options … … 2888 2895 * @type string $type The type of data associated with this setting. 2889 2896 * Valid values are 'string', 'boolean', 'integer', 'number', 'array', and 'object'. 2897 * @type string $label A label of the data attached to this setting. 2890 2898 * @type string $description A description of the data attached to this setting. 2891 2899 * @type callable $sanitize_callback A callback function that sanitizes the option's value. … … 2908 2916 'type' => 'string', 2909 2917 'group' => $option_group, 2918 'label' => '', 2910 2919 'description' => '', 2911 2920 'sanitize_callback' => null, -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-settings-controller.php
r56548 r58230 238 238 $default_schema = array( 239 239 'type' => empty( $args['type'] ) ? null : $args['type'], 240 'title' => empty( $args['label'] ) ? '' : $args['label'], 240 241 'description' => empty( $args['description'] ) ? '' : $args['description'], 241 242 'default' => isset( $args['default'] ) ? $args['default'] : null, -
trunk/tests/phpunit/tests/rest-api/rest-settings-controller.php
r55457 r58230 782 782 $this->assertSame( 3, $response->data['mycustomsetting']['test3'] ); 783 783 } 784 785 /** 786 * @ticket 61023 787 */ 788 public function test_provides_setting_metadata_in_schema() { 789 $request = new WP_REST_Request( 'OPTIONS', '/wp/v2/settings' ); 790 $response = rest_get_server()->dispatch( $request ); 791 $data = $response->get_data(); 792 $title = $data['schema']['properties']['title']; 793 794 $this->assertSame( 'string', $title['type'] ); 795 $this->assertSame( 'Title', $title['title'] ); 796 $this->assertSame( 'Site title.', $title['description'] ); 797 $this->assertSame( null, $title['default'] ); 798 } 784 799 } -
trunk/tests/qunit/fixtures/wp-api-generated.js
r58225 r58230 10739 10739 "args": { 10740 10740 "title": { 10741 "title": "Title", 10741 10742 "description": "Site title.", 10742 10743 "type": "string", … … 10744 10745 }, 10745 10746 "description": { 10747 "title": "Tagline", 10746 10748 "description": "Site tagline.", 10747 10749 "type": "string", … … 10749 10751 }, 10750 10752 "url": { 10753 "title": "", 10751 10754 "description": "Site URL.", 10752 10755 "type": "string", … … 10755 10758 }, 10756 10759 "email": { 10760 "title": "", 10757 10761 "description": "This address is used for admin purposes, like new user notification.", 10758 10762 "type": "string", … … 10761 10765 }, 10762 10766 "timezone": { 10767 "title": "", 10763 10768 "description": "A city in the same timezone as you.", 10764 10769 "type": "string", … … 10766 10771 }, 10767 10772 "date_format": { 10773 "title": "", 10768 10774 "description": "A date format for all date strings.", 10769 10775 "type": "string", … … 10771 10777 }, 10772 10778 "time_format": { 10779 "title": "", 10773 10780 "description": "A time format for all time strings.", 10774 10781 "type": "string", … … 10776 10783 }, 10777 10784 "start_of_week": { 10785 "title": "", 10778 10786 "description": "A day number of the week that the week should start on.", 10779 10787 "type": "integer", … … 10781 10789 }, 10782 10790 "language": { 10791 "title": "", 10783 10792 "description": "WordPress locale code.", 10784 10793 "type": "string", … … 10786 10795 }, 10787 10796 "use_smilies": { 10797 "title": "", 10788 10798 "description": "Convert emoticons like :-) and :-P to graphics on display.", 10789 10799 "type": "boolean", … … 10791 10801 }, 10792 10802 "default_category": { 10803 "title": "", 10793 10804 "description": "Default post category.", 10794 10805 "type": "integer", … … 10796 10807 }, 10797 10808 "default_post_format": { 10809 "title": "", 10798 10810 "description": "Default post format.", 10799 10811 "type": "string", … … 10801 10813 }, 10802 10814 "posts_per_page": { 10815 "title": "Maximum posts per page", 10803 10816 "description": "Blog pages show at most.", 10804 10817 "type": "integer", … … 10806 10819 }, 10807 10820 "show_on_front": { 10821 "title": "Show on front", 10808 10822 "description": "What to show on the front page", 10809 10823 "type": "string", … … 10811 10825 }, 10812 10826 "page_on_front": { 10827 "title": "Page on front", 10813 10828 "description": "The ID of the page that should be displayed on the front page", 10814 10829 "type": "integer", … … 10816 10831 }, 10817 10832 "page_for_posts": { 10833 "title": "", 10818 10834 "description": "The ID of the page that should display the latest posts", 10819 10835 "type": "integer", … … 10821 10837 }, 10822 10838 "default_ping_status": { 10839 "title": "", 10823 10840 "description": "Allow link notifications from other blogs (pingbacks and trackbacks) on new articles.", 10824 10841 "type": "string", … … 10830 10847 }, 10831 10848 "default_comment_status": { 10849 "title": "Allow comments on new posts", 10832 10850 "description": "Allow people to submit comments on new posts.", 10833 10851 "type": "string", … … 10839 10857 }, 10840 10858 "site_logo": { 10859 "title": "", 10841 10860 "description": "Site logo.", 10842 10861 "type": "integer", … … 10844 10863 }, 10845 10864 "site_icon": { 10865 "title": "", 10846 10866 "description": "Site icon.", 10847 10867 "type": "integer",
Note: See TracChangeset
for help on using the changeset viewer.