PluginProbe
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder / 2.8.0
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder v2.8.0
2.12.0 2.11.1 2.11.0 2.10.0 2.9.0 2.7.4 2.7.5 2.7.6 2.7.7 2.8.0 2.8.1 2.9.1 trunk 1.0 1.0-beta1 1.0-beta2 1.0-beta3 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.2.0 1.2.1 All 78 releases
ablocks / includes / blocks / video / block.php

block.php in aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder 2.8.0, at includes/blocks/video/block.php

67 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace ABlocks\Blocks\Video;
3
4 if ( ! defined( 'ABSPATH' ) ) {
5 exit;
6 }
7
8 use ABlocks\Classes\BlockBaseAbstract;
9 use ABlocks\Classes\CssGenerator;
10 use ABlocks\Classes\CssGeneratorV2;
11 use ABlocks\Controls\CssFilter;
12
13 class Block extends BlockBaseAbstract {
14 protected $block_name = 'video';
15
16 public function build_css_v1( $attributes ) {
17
18 // Generate CSS start
19 $css_generator = new CssGenerator( $attributes, $this->block_name );
20
21 // Video Container CSS
22 $css_generator->add_class_styles(
23 '{{WRAPPER}} .ablocks-block-container',
24 $this->get_video_container_css( $attributes ),
25 $this->get_video_container_css( $attributes, 'Tablet' ),
26 $this->get_video_container_css( $attributes, 'Mobile' ),
27 );
28
29 return $css_generator->generate_css();
30 // Generate CSS end
31 }
32 public function build_css_v2( $attributes ) {
33
34 // Generate CSS start
35 $css_generator = new CssGeneratorV2( $attributes, $this->block_name );
36
37 // Video Container CSS
38 $css_generator->add_class_styles(
39 '{{WRAPPER}}',
40 $this->get_video_container_css( $attributes ),
41 $this->get_video_container_css( $attributes, 'Tablet' ),
42 $this->get_video_container_css( $attributes, 'Mobile' ),
43 );
44
45 return $css_generator->generate_css();
46 // Generate CSS end
47 }
48
49 public function build_css( $attributes ) {
50 if ( isset( $attributes['blockVersion'] ) && (int) $attributes['blockVersion'] === 2 ) {
51 return $this->build_css_v2( $attributes );
52 }
53 return $this->build_css_v1( $attributes );
54 }
55 public function get_video_container_css( $attributes, $device = '' ) {
56 $css = [];
57 if ( ! empty( $attributes['aspectRatio'] ) ) {
58 $css['aspect-ratio'] = $attributes['aspectRatio'];
59 }
60
61 return array_merge(
62 $css,
63 isset( $attributes['cssFilter'] ) ? CssFilter::get_css( $attributes['cssFilter'], '', $device ) : [],
64 );
65 }
66 }
67