Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 32
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
Module_Styles_Trait
0.00% covered (danger)
0.00%
0 / 30
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 module_styles
0.00% covered (danger)
0.00%
0 / 30
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2/**
3 * Style output for the Divi 5 VideoPress module.
4 *
5 * @package automattic/jetpack-videopress
6 */
7
8declare( strict_types = 1 );
9
10namespace Automattic\Jetpack\VideoPress\Divi5\Traits;
11
12use ET\Builder\FrontEnd\Module\Style;
13use ET\Builder\Packages\Module\Options\Css\CssStyle;
14
15if ( ! defined( 'ABSPATH' ) ) {
16    exit( 0 );
17}
18
19/**
20 * Emits the module's styles, mirroring the Visual Builder style component.
21 */
22trait Module_Styles_Trait {
23
24    use Custom_Css_Trait;
25
26    /**
27     * Adds the module's styles to the style registry.
28     *
29     * @param array $args The style callback arguments.
30     *
31     * @return void
32     */
33    public static function module_styles( $args ) {
34        $attrs    = $args['attrs'] ?? array();
35        $elements = $args['elements'];
36        $settings = $args['settings'] ?? array();
37
38        Style::add(
39            array(
40                'id'            => $args['id'] ?? '',
41                'name'          => $args['name'] ?? '',
42                'orderIndex'    => $args['orderIndex'] ?? 0,
43                'storeInstance' => $args['storeInstance'] ?? null,
44                'styles'        => array(
45                    $elements->style(
46                        array(
47                            'attrName'   => 'module',
48                            'styleProps' => array(
49                                'disabledOn' => array(
50                                    'disabledModuleVisibility' => $settings['disabledModuleVisibility'] ?? null,
51                                ),
52                            ),
53                        )
54                    ),
55                    CssStyle::style(
56                        array(
57                            'selector'  => $args['orderClass'],
58                            'attr'      => $attrs['css'] ?? array(),
59                            'cssFields' => self::custom_css(),
60                        )
61                    ),
62                ),
63            )
64        );
65    }
66}