| 1 |
<?php |
| 2 |
namespace ABlocks\Classes; |
| 3 |
|
| 4 |
if ( ! defined( 'ABSPATH' ) ) { |
| 5 |
exit; |
| 6 |
} |
| 7 |
|
| 8 |
abstract class ControlBaseAbstract { |
| 9 |
abstract public static function get_attribute_default_value( $is_responsive = false); |
| 10 |
abstract public static function get_attribute( $attributeName, $is_responsive = false); |
| 11 |
abstract public static function get_css( $attribute_value, $property = '', $device = ''); |
| 12 |
public static function has_value( $value ) { |
| 13 |
return isset( $value ) && ! empty( $value ); |
| 14 |
} |
| 15 |
public static function get_unit( $attributeValue, $device = '' ) { |
| 16 |
$unit = $attributeValue['unit']; |
| 17 |
|
| 18 |
if ( '' === $device ) { |
| 19 |
return $unit; |
| 20 |
} |
| 21 |
|
| 22 |
$unitTablet = $attributeValue['unitTablet']; |
| 23 |
$unitMobile = $attributeValue['unitMobile']; |
| 24 |
|
| 25 |
if ( 'Tablet' === $device ) { |
| 26 |
return '' !== $unitTablet ? $unitTablet : $unit; |
| 27 |
} elseif ( 'Mobile' === $device ) { |
| 28 |
return '' !== $unitMobile ? $unitMobile : ( '' !== $unitTablet ? $unitTablet : $unit ); |
| 29 |
} |
| 30 |
|
| 31 |
return $unit; |
| 32 |
} |
| 33 |
} |
| 34 |
|