← All changes
|
jetpack_vendor/automattic/jetpack-premium-analytics/src/widget-modules.php
+8
-4
16.2
→
16.3-beta
View file →
| @@ -29,12 +29,13 @@ | ||
| 29 | 29 | ); |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | /** |
| 33 | - * Load and hydrate the widget type registry, once. | |
| 33 | + * Load the widget type API and the build manifest, once, ahead of the registry's first read. | |
| 34 | 34 | * |
| 35 | 35 | * Deferred to the registry's only two readers rather than run at boot: on Simple this file's |
| 36 | - * registration runs on every WPCOM public-api request, and most never read the registry. | |
| 36 | + * registration runs on every WPCOM public-api request, and most never read the registry. The | |
| 37 | + * registry hydrates itself on that read, from the registration action. | |
| 37 | 38 | * |
| 38 | 39 | * @return void |
| 39 | 40 | */ |
| 40 | 41 | function ensure_widget_registry_ready() { |
| @@ -52,10 +53,8 @@ | ||
| 52 | 53 | $widgets_manifest = Analytics::widget_manifest_path(); |
| 53 | 54 | if ( file_exists( $widgets_manifest ) ) { |
| 54 | 55 | require_once $widgets_manifest; |
| 55 | 56 | } |
| 56 | - | |
| 57 | - bootstrap_widget_types(); | |
| 58 | 57 | } |
| 59 | 58 | |
| 60 | 59 | /** |
| 61 | 60 | * Build the REST response: one record per available widget type. |
| @@ -76,9 +75,14 @@ | ||
| 76 | 75 | 'category' => $widget_type->category, |
| 77 | 76 | 'title' => $widget_type->title, |
| 78 | 77 | 'description' => $widget_type->description, |
| 79 | 78 | 'help' => $widget_type->help, |
| 79 | + 'icon' => $widget_type->icon, | |
| 80 | + 'actions' => $widget_type->actions, | |
| 80 | 81 | 'keywords' => $widget_type->keywords, |
| 82 | + 'textdomain' => $widget_type->textdomain, | |
| 83 | + 'i18n_manifest' => $widget_type->i18n_manifest, | |
| 84 | + 'former_names' => $widget_type->former_names, | |
| 81 | 85 | ); |
| 82 | 86 | } |
| 83 | 87 | |
| 84 | 88 | return rest_ensure_response( $records ); |