← All changes
|
jetpack_vendor/automattic/jetpack-connection/src/class-connection-assets.php
+18
-0
16.2
→
16.3-beta
View file →
| @@ -20,8 +20,26 @@ | ||
| 20 | 20 | public static function configure() { |
| 21 | 21 | add_action( 'wp_loaded', array( __CLASS__, 'register_assets' ) ); |
| 22 | 22 | |
| 23 | 23 | add_filter( 'jetpack_admin_js_script_data', array( Initial_State::class, 'set_connection_script_data' ), 10, 1 ); |
| 24 | + // Priority 20: set_connection_script_data() replaces the whole `connection` key at 10. | |
| 25 | + add_filter( 'jetpack_admin_js_script_data', array( __CLASS__, 'add_script_data' ), 20 ); | |
| 26 | + } | |
| 27 | + | |
| 28 | + /** | |
| 29 | + * Add the package's image base URL to the admin script data. | |
| 30 | + * | |
| 31 | + * Other plugins' bundles request the disconnect dialog's images from this copy, so never rename one. | |
| 32 | + * | |
| 33 | + * @since 9.3.0 | |
| 34 | + * | |
| 35 | + * @param array $data Script data. | |
| 36 | + * @return array | |
| 37 | + */ | |
| 38 | + public static function add_script_data( $data ) { | |
| 39 | + $data['connection']['assetsUrl'] = trailingslashit( plugins_url( 'assets/images/', __DIR__ ) ); | |
| 40 | + | |
| 41 | + return $data; | |
| 24 | 42 | } |
| 25 | 43 | |
| 26 | 44 | /** |
| 27 | 45 | * Register assets. |