Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 24 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
||
| 1 | <?php |
| 2 | /** |
| 3 | * Register VideoPress Video block. |
| 4 | * |
| 5 | * @package automattic/jetpack |
| 6 | **/ |
| 7 | |
| 8 | namespace Automattic\Jetpack\Extensions\VideoPress_Video; |
| 9 | |
| 10 | use Automattic\Jetpack\VideoPress\Initializer as VideoPress_Pkg_Initializer; |
| 11 | |
| 12 | if ( ! defined( 'ABSPATH' ) ) { |
| 13 | exit( 0 ); |
| 14 | } |
| 15 | |
| 16 | // Set the videopress/video block availability, depending on the site plan. |
| 17 | add_action( |
| 18 | 'jetpack_register_gutenberg_extensions', |
| 19 | function () { |
| 20 | \Jetpack_Gutenberg::set_availability_for_plan( 'videopress/video' ); |
| 21 | } |
| 22 | ); |
| 23 | |
| 24 | // Register the videopress/video block. |
| 25 | add_action( |
| 26 | 'init', |
| 27 | function () { |
| 28 | $extensions = \Jetpack_Gutenberg::get_extensions(); |
| 29 | $is_videopress_video_extension_enabled = in_array( 'videopress/video', $extensions, true ); |
| 30 | |
| 31 | if ( |
| 32 | $is_videopress_video_extension_enabled && |
| 33 | method_exists( 'Automattic\Jetpack\VideoPress\Initializer', 'register_videopress_video_block' ) |
| 34 | ) { |
| 35 | VideoPress_Pkg_Initializer::register_videopress_video_block(); |
| 36 | } |
| 37 | } |
| 38 | ); |
| 39 | |
| 40 | // Register the `v6-video-frame-poster` extension. |
| 41 | add_action( |
| 42 | 'jetpack_register_gutenberg_extensions', |
| 43 | function () { |
| 44 | \Jetpack_Gutenberg::set_extension_available( 'v6-video-frame-poster' ); |
| 45 | } |
| 46 | ); |