PluginProbe
Gutenberg / trunk
Gutenberg vtrunk
24.1.0 24.0.0 23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 All 404 releases
← All changes | lib/experimental/dashboard-widgets/class-wp-rest-widget-modules-controller.php +156 -0 23.4.0 → trunk View file →
@@ -194,8 +194,40 @@
194 194 if ( rest_is_field_included( 'presentation', $fields ) ) {
195 195 $data['presentation'] = $widget_type->presentation;
196 196 }
197 197
198 + if ( rest_is_field_included( 'category', $fields ) ) {
199 + $data['category'] = $widget_type->category;
200 + }
201 +
202 + if ( rest_is_field_included( 'title', $fields ) ) {
203 + $data['title'] = $widget_type->title;
204 + }
205 +
206 + if ( rest_is_field_included( 'description', $fields ) ) {
207 + $data['description'] = $widget_type->description;
208 + }
209 +
210 + if ( rest_is_field_included( 'help', $fields ) ) {
211 + $data['help'] = $widget_type->help;
212 + }
213 +
214 + if ( rest_is_field_included( 'icon', $fields ) ) {
215 + $data['icon'] = $widget_type->icon;
216 + }
217 +
218 + if ( rest_is_field_included( 'actions', $fields ) ) {
219 + $data['actions'] = $widget_type->actions;
220 + }
221 +
222 + if ( rest_is_field_included( 'attributes', $fields ) ) {
223 + $data['attributes'] = $widget_type->attributes;
224 + }
225 +
226 + if ( rest_is_field_included( 'keywords', $fields ) ) {
227 + $data['keywords'] = $widget_type->keywords;
228 + }
229 +
198 230 $context = ! empty( $request['context'] ) ? $request['context'] : 'view';
199 231 $data = $this->add_additional_fields_to_object( $data, $request );
200 232 $data = $this->filter_response_by_context( $data, $context );
201 233
@@ -241,8 +273,132 @@
241 273 'presentation' => array(
242 274 'description' => __( 'Authoring intent about how the widget wants to render.', 'gutenberg' ),
243 275 'type' => array( 'string', 'null' ),
244 276 'enum' => array_merge( WP_Widget_Type::PRESENTATION_VALUES, array( null ) ),
277 + 'context' => array( 'view', 'edit', 'embed' ),
278 + 'readonly' => true,
279 + ),
280 +
281 + 'category' => array(
282 + 'description' => __( 'Widget types are grouped into categories to help users browse and discover them.', 'gutenberg' ),
283 + 'type' => array( 'string', 'null' ),
284 + 'context' => array( 'view', 'edit', 'embed' ),
285 + 'readonly' => true,
286 + ),
287 +
288 + 'title' => array(
289 + 'description' => __( 'Human-readable title that names the widget type. Translatable.', 'gutenberg' ),
290 + 'type' => array( 'string', 'null' ),
291 + 'context' => array( 'view', 'edit', 'embed' ),
292 + 'readonly' => true,
293 + ),
294 +
295 + 'description' => array(
296 + 'description' => __( 'Human-readable description of what the widget type does. Translatable.', 'gutenberg' ),
297 + 'type' => array( 'string', 'null' ),
298 + 'context' => array( 'view', 'edit', 'embed' ),
299 + 'readonly' => true,
300 + ),
301 +
302 + 'help' => array(
303 + 'description' => __( 'Contextual help note for the widget type: content plus optional links. Translatable.', 'gutenberg' ),
304 + 'type' => array( 'object', 'null' ),
305 + 'properties' => array(
306 + 'content' => array(
307 + 'description' => __( 'Help content; may carry minimal inline emphasis.', 'gutenberg' ),
308 + 'type' => 'string',
309 + ),
310 + 'links' => array(
311 + 'description' => __( 'Optional links contextual to the help content.', 'gutenberg' ),
312 + 'type' => 'array',
313 + 'items' => array(
314 + 'type' => 'object',
315 + 'properties' => array(
316 + 'label' => array( 'type' => 'string' ),
317 + 'href' => array( 'type' => 'string' ),
318 + ),
319 + ),
320 + ),
321 + ),
322 + 'context' => array( 'view', 'edit', 'embed' ),
323 + 'readonly' => true,
324 + ),
325 +
326 + 'icon' => array(
327 + 'description' => __( 'Registered icon name identifying the widget type visually.', 'gutenberg' ),
328 + 'type' => array( 'string', 'null' ),
329 + 'context' => array( 'view', 'edit', 'embed' ),
330 + 'readonly' => true,
331 + ),
332 +
333 + 'actions' => array(
334 + 'description' => __( 'Declarative actions the widget type exposes. Labels are translatable.', 'gutenberg' ),
335 + 'type' => array( 'array', 'null' ),
336 + 'items' => array(
337 + 'type' => 'object',
338 + 'properties' => array(
339 + 'id' => array( 'type' => 'string' ),
340 + 'label' => array( 'type' => 'string' ),
341 + 'icon' => array( 'type' => 'string' ),
342 + 'relevance' => array(
343 + 'type' => 'string',
344 + 'enum' => array( 'high', 'medium', 'low' ),
345 + ),
346 + 'href' => array( 'type' => 'string' ),
347 + 'download' => array( 'type' => array( 'string', 'boolean' ) ),
348 + 'openInNewTab' => array( 'type' => 'boolean' ),
349 + ),
350 + ),
351 + 'context' => array( 'view', 'edit', 'embed' ),
352 + 'readonly' => true,
353 + ),
354 +
355 + 'attributes' => array(
356 + 'description' => __( 'Attribute schema hosts render settings from: the JSON-expressible subset of a DataViews field per entry. User-facing strings are translatable.', 'gutenberg' ),
357 + 'type' => array( 'array', 'null' ),
358 + 'items' => array(
359 + 'type' => 'object',
360 + 'properties' => array(
361 + 'id' => array( 'type' => 'string' ),
362 + 'type' => array( 'type' => 'string' ),
363 + 'label' => array( 'type' => 'string' ),
364 + 'header' => array( 'type' => 'string' ),
365 + 'description' => array( 'type' => 'string' ),
366 + 'placeholder' => array( 'type' => 'string' ),
367 + 'readOnly' => array( 'type' => 'boolean' ),
368 + 'isDisabled' => array( 'type' => 'boolean' ),
369 + 'enableSorting' => array( 'type' => 'boolean' ),
370 + 'enableHiding' => array( 'type' => 'boolean' ),
371 + 'enableGlobalSearch' => array( 'type' => 'boolean' ),
372 + 'elements' => array(
373 + 'type' => 'array',
374 + 'items' => array(
375 + 'type' => 'object',
376 + 'properties' => array(
377 + 'value' => array( 'type' => array( 'string', 'integer', 'number', 'boolean', 'null' ) ),
378 + 'label' => array( 'type' => 'string' ),
379 + 'description' => array( 'type' => 'string' ),
380 + ),
381 + ),
382 + ),
383 + 'filterBy' => array( 'type' => array( 'object', 'boolean' ) ),
384 + 'format' => array( 'type' => 'object' ),
385 + 'isValid' => array( 'type' => 'object' ),
386 + 'Edit' => array( 'type' => array( 'string', 'object' ) ),
387 + 'relevance' => array(
388 + 'type' => 'string',
389 + 'enum' => array( 'high', 'medium', 'low' ),
390 + ),
391 + ),
392 + ),
393 + 'context' => array( 'view', 'edit', 'embed' ),
394 + 'readonly' => true,
395 + ),
396 +
397 + 'keywords' => array(
398 + 'description' => __( 'Alternative terms used to match the widget type when searching, e.g. "calendar" for an events widget. Translatable.', 'gutenberg' ),
399 + 'type' => array( 'array', 'null' ),
400 + 'items' => array( 'type' => 'string' ),
245 401 'context' => array( 'view', 'edit', 'embed' ),
246 402 'readonly' => true,
247 403 ),
248 404 ),