Skip to content

Commit

Permalink
Load external-media assets
Browse files Browse the repository at this point in the history
  • Loading branch information
arthur791004 committed Jan 23, 2025
1 parent 9fbc56e commit e112bc4
Showing 1 changed file with 29 additions and 3 deletions.
32 changes: 29 additions & 3 deletions projects/packages/external-media/src/class-external-media.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,42 @@
<?php
/**
* Package description here
* Register the external media to both WP Admin and Editor.
*
* @package automattic/jetpack-external-media
*/

namespace Automattic\Jetpack;

/**
* Class description.
* Class External_Media
*/
class External_Media {

const PACKAGE_VERSION = '0.1.0-alpha';
const BASE_DIR = __DIR__ . '/';
const BASE_FILE = __FILE__;

/**
* Add hooks and filters.
*/
public static function init() {
add_action( 'enqueue_block_editor_assets', array( __CLASS__, 'enqueue_block_editor_assets' ) );
}

/**
* Enqueue block editor assets.
*/
public static function enqueue_block_editor_assets() {
$assets_base_path = 'build/';
$asset_name = 'jetpack-external-media-editor';

Assets::register_script(
$asset_name,
$assets_base_path . "$asset_name/$asset_name.js",
__FILE__,
array(
'enqueue' => true,
'css_path' => $assets_base_path . "$asset_name/$asset_name" . is_rtl() ? '.rtl.css' : '.css',
)
);
}
}

0 comments on commit e112bc4

Please sign in to comment.