PluginProbe
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder / 2.9.1
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder v2.9.1
2.13.0 2.13.1 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 All 80 releases
ablocks / includes / controls / text-stroke.php

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

57 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
10 class TextStroke extends ControlBaseAbstract {
11 public static function get_attribute_default_value( $is_responsive = false ) {
12 if ( $is_responsive ) {
13 return array(
14 'strokeWidth' => '',
15 'strokeWidthTablet' => '',
16 'strokeWidthMobile' => '',
17 'strokeWidthUnit' => 'px',
18 'strokeWidthUnitTablet' => 'px',
19 'strokeWidthUnitMobile' => 'px',
20 'stroke' => '',
21 );
22 }
23 return array(
24 'strokeWidth' => '',
25 'strokeWidthUnit' => 'px',
26 'stroke' => '',
27 );
28 }
29
30 public static function get_attribute( $attributeName, $isResponsive = false ) {
31 return [
32 $attributeName => [
33 'type' => 'object',
34 'default' => self::get_attribute_default_value( $isResponsive ),
35 ]
36 ];
37 }
38
39 public static function get_css( $attribute_value, $property = '', $device = '' ) {
40 if ( empty( $attribute_value ) ) {
41 return [];
42 }
43 $default_attar_value = self::get_attribute_default_value( (bool) $device );
44 $value = wp_parse_args( $attribute_value, $default_attar_value );
45 $css = [];
46
47 if ( '' !== $value[ 'strokeWidth' . $device ] ) {
48 $css['-webkit-text-stroke-width'] = $value[ 'strokeWidth' . $device ] . $value[ 'strokeWidthUnit' . $device ];
49 $css['-webkit-text-stroke-color'] = '' !== $value['stroke'] ? $value['stroke'] : '#000';
50 }
51
52 return $css;
53 }
54
55
56 }
57