PluginProbe
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder / trunk
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder vtrunk
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 / controls / text-shadow.php

text-shadow.php in aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder trunk, at includes/controls/text-shadow.php

56 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace ABlocks\Controls;
3
4 if ( ! defined( 'ABSPATH' ) ) {
5 exit;
6 }
7
8 use ABlocks\Classes\ControlBaseAbstract;
9 use ABlocks\Controls\Color;
10
11 class TextShadow extends ControlBaseAbstract {
12 public static function get_attribute_default_value( $is_responsive = false ) {
13 return array(
14 'color' => '',
15 'blur' => '',
16 'horizontal' => '',
17 'vertical' => '',
18 );
19 }
20
21 public static function get_attribute( $attributeName, $isResponsive = false ) {
22 return [
23 $attributeName => [
24 'type' => 'object',
25 'default' => self::get_attribute_default_value( $isResponsive ),
26 ]
27 ];
28 }
29
30 public static function get_css( $attribute_value, $property = '', $device = '' ) {
31 if ( empty( $attribute_value ) ) {
32 return [];
33 }
34 $default_attar_value = self::get_attribute_default_value( (bool) $device );
35 $value = wp_parse_args( $attribute_value, $default_attar_value );
36 $css = [];
37
38 if (
39 '' !== $value['color'] ||
40 '' !== $value['horizontal'] ||
41 '' !== $value['vertical'] ||
42 '' !== $value['blur']
43 ) {
44 $horizontal = '' !== $value['horizontal'] ? $value['horizontal'] : '0';
45 $vertical = '' !== $value['vertical'] ? $value['vertical'] : '0';
46 $blur = '' !== $value['blur'] ? $value['blur'] : '10';
47 $color = '' !== $value['color'] ? $value['color'] : 'rgba(0, 0, 0, 0.3)';
48 $css['text-shadow'] = $horizontal . 'px ' . $vertical . 'px ' . $blur . 'px ' . Color::get_css( $color );
49 }
50
51 return $css;
52 }
53
54
55 }
56