88 */
99
1010declare ( strict_types = 1 );
11+
1112/**
1213 * Registers the core ability categories.
1314 *
@@ -44,16 +45,41 @@ function wp_register_core_abilities(): void {
4445 $ category_site = 'site ' ;
4546 $ category_user = 'user ' ;
4647
47- $ site_info_fields = array (
48- 'name ' ,
49- 'description ' ,
50- 'url ' ,
51- 'wpurl ' ,
52- 'admin_email ' ,
53- 'charset ' ,
54- 'language ' ,
55- 'version ' ,
48+ $ site_info_properties = array (
49+ 'name ' => array (
50+ 'type ' => 'string ' ,
51+ 'description ' => __ ( 'The site title. ' ),
52+ ),
53+ 'description ' => array (
54+ 'type ' => 'string ' ,
55+ 'description ' => __ ( 'The site tagline. ' ),
56+ ),
57+ 'url ' => array (
58+ 'type ' => 'string ' ,
59+ 'description ' => __ ( 'The site home URL. ' ),
60+ ),
61+ 'wpurl ' => array (
62+ 'type ' => 'string ' ,
63+ 'description ' => __ ( 'The WordPress installation URL. ' ),
64+ ),
65+ 'admin_email ' => array (
66+ 'type ' => 'string ' ,
67+ 'description ' => __ ( 'The site administrator email address. ' ),
68+ ),
69+ 'charset ' => array (
70+ 'type ' => 'string ' ,
71+ 'description ' => __ ( 'The site character encoding. ' ),
72+ ),
73+ 'language ' => array (
74+ 'type ' => 'string ' ,
75+ 'description ' => __ ( 'The site language locale code. ' ),
76+ ),
77+ 'version ' => array (
78+ 'type ' => 'string ' ,
79+ 'description ' => __ ( 'The WordPress version. ' ),
80+ ),
5681 );
82+ $ site_info_fields = array_keys ( $ site_info_properties );
5783
5884 wp_register_ability (
5985 'core/get-site-info ' ,
@@ -78,40 +104,7 @@ function wp_register_core_abilities(): void {
78104 ),
79105 'output_schema ' => array (
80106 'type ' => 'object ' ,
81- 'properties ' => array (
82- 'name ' => array (
83- 'type ' => 'string ' ,
84- 'description ' => __ ( 'The site title. ' ),
85- ),
86- 'description ' => array (
87- 'type ' => 'string ' ,
88- 'description ' => __ ( 'The site tagline. ' ),
89- ),
90- 'url ' => array (
91- 'type ' => 'string ' ,
92- 'description ' => __ ( 'The site home URL. ' ),
93- ),
94- 'wpurl ' => array (
95- 'type ' => 'string ' ,
96- 'description ' => __ ( 'The WordPress installation URL. ' ),
97- ),
98- 'admin_email ' => array (
99- 'type ' => 'string ' ,
100- 'description ' => __ ( 'The site administrator email address. ' ),
101- ),
102- 'charset ' => array (
103- 'type ' => 'string ' ,
104- 'description ' => __ ( 'The site character encoding. ' ),
105- ),
106- 'language ' => array (
107- 'type ' => 'string ' ,
108- 'description ' => __ ( 'The site language locale code. ' ),
109- ),
110- 'version ' => array (
111- 'type ' => 'string ' ,
112- 'description ' => __ ( 'The WordPress version. ' ),
113- ),
114- ),
107+ 'properties ' => $ site_info_properties ,
115108 'additionalProperties ' => false ,
116109 ),
117110 'execute_callback ' => static function ( $ input = array () ) use ( $ site_info_fields ): array {
0 commit comments