Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| Custom_Css_Trait | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 1 |
| custom_css | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
6 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * Custom CSS fields for the Divi 5 VideoPress module. |
| 4 | * |
| 5 | * @package automattic/jetpack-videopress |
| 6 | */ |
| 7 | |
| 8 | declare( strict_types = 1 ); |
| 9 | |
| 10 | namespace Automattic\Jetpack\VideoPress\Divi5\Traits; |
| 11 | |
| 12 | use Automattic\Jetpack\VideoPress\Divi5\VideoPress_Module; |
| 13 | use WP_Block_Type; |
| 14 | use WP_Block_Type_Registry; |
| 15 | |
| 16 | if ( ! defined( 'ABSPATH' ) ) { |
| 17 | exit( 0 ); |
| 18 | } |
| 19 | |
| 20 | /** |
| 21 | * Exposes the module's custom CSS fields, as declared in `module.json`. |
| 22 | */ |
| 23 | trait Custom_Css_Trait { |
| 24 | |
| 25 | /** |
| 26 | * Returns the registered custom CSS fields for the module. |
| 27 | * |
| 28 | * @return array The custom CSS field definitions. |
| 29 | */ |
| 30 | public static function custom_css() { |
| 31 | $block_type = WP_Block_Type_Registry::get_instance()->get_registered( VideoPress_Module::MODULE_NAME ); |
| 32 | |
| 33 | if ( ! $block_type instanceof WP_Block_Type ) { |
| 34 | return array(); |
| 35 | } |
| 36 | |
| 37 | // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase -- Property defined by the Divi 5 framework. |
| 38 | return $block_type->customCssFields ?? array(); |
| 39 | } |
| 40 | } |