← All changes
|
lib/experimental/dashboard-widgets/class-wp-rest-widget-modules-controller.php
+83
-0
23.6.0
→
trunk
View file →
| @@ -210,8 +210,20 @@ | ||
| 210 | 210 | if ( rest_is_field_included( 'help', $fields ) ) { |
| 211 | 211 | $data['help'] = $widget_type->help; |
| 212 | 212 | } |
| 213 | 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 | + | |
| 214 | 226 | if ( rest_is_field_included( 'keywords', $fields ) ) { |
| 215 | 227 | $data['keywords'] = $widget_type->keywords; |
| 216 | 228 | } |
| 217 | 229 | |
| @@ -303,8 +315,79 @@ | ||
| 303 | 315 | 'properties' => array( |
| 304 | 316 | 'label' => array( 'type' => 'string' ), |
| 305 | 317 | 'href' => array( 'type' => 'string' ), |
| 306 | 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' ), | |
| 307 | 390 | ), |
| 308 | 391 | ), |
| 309 | 392 | ), |
| 310 | 393 | 'context' => array( 'view', 'edit', 'embed' ), |