-
Notifications
You must be signed in to change notification settings - Fork 814
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9fbc56e
commit e112bc4
Showing
1 changed file
with
29 additions
and
3 deletions.
There are no files selected for viewing
32 changes: 29 additions & 3 deletions
32
projects/packages/external-media/src/class-external-media.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', | ||
) | ||
); | ||
} | ||
} |