Changeset 53154
- Timestamp:
- 04/12/2022 12:46:08 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-block-patterns-controller.php
r53152 r53154 108 108 $fields = $this->get_fields_for_response( $request ); 109 109 $keys = array( 110 'name' ,111 'title' ,112 'description' ,113 'viewportWidth' ,114 'blockTypes' ,115 'categories' ,116 'keywords' ,117 'content' ,110 'name' => 'name', 111 'title' => 'title', 112 'description' => 'description', 113 'viewportWidth' => 'viewport_width', 114 'blockTypes' => 'block_types', 115 'categories' => 'categories', 116 'keywords' => 'keywords', 117 'content' => 'content', 118 118 ); 119 119 $data = array(); 120 foreach ( $keys as $ key ) {121 if ( isset( $item[ $ key ] ) && rest_is_field_included( $key, $fields ) ) {122 $data[ $ key ] = $item[ $key ];120 foreach ( $keys as $item_key => $rest_key ) { 121 if ( isset( $item[ $item_key ] ) && rest_is_field_included( $rest_key, $fields ) ) { 122 $data[ $rest_key ] = $item[ $item_key ]; 123 123 } 124 124 } … … 143 143 'type' => 'object', 144 144 'properties' => array( 145 'name' => array(145 'name' => array( 146 146 'description' => __( 'The pattern name.' ), 147 147 'type' => 'string', … … 149 149 'context' => array( 'view', 'edit', 'embed' ), 150 150 ), 151 'title' => array(151 'title' => array( 152 152 'description' => __( 'The pattern title, in human readable format.' ), 153 153 'type' => 'string', … … 155 155 'context' => array( 'view', 'edit', 'embed' ), 156 156 ), 157 'description' => array(157 'description' => array( 158 158 'description' => __( 'The pattern detailed description.' ), 159 159 'type' => 'string', … … 161 161 'context' => array( 'view', 'edit', 'embed' ), 162 162 ), 163 'viewport Width' => array(163 'viewport_Width' => array( 164 164 'description' => __( 'The pattern viewport width for inserter preview.' ), 165 165 'type' => 'number', … … 167 167 'context' => array( 'view', 'edit', 'embed' ), 168 168 ), 169 'block Types' => array(169 'block_Types' => array( 170 170 'description' => __( 'Block types that the pattern is intended to be used with.' ), 171 171 'type' => 'array', … … 173 173 'context' => array( 'view', 'edit', 'embed' ), 174 174 ), 175 'categories' => array(175 'categories' => array( 176 176 'description' => __( 'The pattern category slugs.' ), 177 177 'type' => 'array', … … 179 179 'context' => array( 'view', 'edit', 'embed' ), 180 180 ), 181 'keywords' => array(181 'keywords' => array( 182 182 'description' => __( 'The pattern keywords.' ), 183 183 'type' => 'array', … … 185 185 'context' => array( 'view', 'edit', 'embed' ), 186 186 ), 187 'content' => array(187 'content' => array( 188 188 'description' => __( 'The pattern content.' ), 189 189 'type' => 'string',
Note: See TracChangeset
for help on using the changeset viewer.