| 1 |
<?php |
| 2 |
/** |
| 3 |
* Jetpack_Script_Data. |
| 4 |
* |
| 5 |
* Adds Jetpack-plugin-specific data to the consolidated JetpackScriptData object. |
| 6 |
* |
| 7 |
* @package automattic/jetpack |
| 8 |
*/ |
| 9 |
|
| 10 |
namespace Automattic\Jetpack\Plugin; |
| 11 |
|
| 12 |
/** |
| 13 |
* Jetpack_Script_Data class. |
| 14 |
*/ |
| 15 |
class Jetpack_Script_Data { |
| 16 |
|
| 17 |
/** |
| 18 |
* Configure script data. |
| 19 |
*/ |
| 20 |
public static function configure() { |
| 21 |
add_filter( 'jetpack_admin_js_script_data', array( __CLASS__, 'set_admin_script_data' ), 10, 1 ); |
| 22 |
} |
| 23 |
|
| 24 |
/** |
| 25 |
* Add Jetpack-plugin-specific data to the consolidated JetpackScriptData object. |
| 26 |
* |
| 27 |
* @since 15.6 |
| 28 |
* |
| 29 |
* @param array $data The script data. |
| 30 |
* @return array |
| 31 |
*/ |
| 32 |
public static function set_admin_script_data( $data ) { |
| 33 |
/** |
| 34 |
* Whether to show the Jetpack branding in editor panels (e.g., SEO, AI Assistant). |
| 35 |
* |
| 36 |
* @since 15.6 |
| 37 |
* |
| 38 |
* @param bool $show Whether to show the Jetpack editor panel branding. Defaults to true. |
| 39 |
*/ |
| 40 |
$data['jetpack'] = array( |
| 41 |
'flags' => array( |
| 42 |
'showJetpackBranding' => (bool) apply_filters( 'jetpack_show_editor_panel_branding', true ), |
| 43 |
), |
| 44 |
); |
| 45 |
|
| 46 |
return $data; |
| 47 |
} |
| 48 |
} |
| 49 |
|