Animation.php
4 years ago
Background.php
1 year ago
BackgroundImage.php
1 year ago
Border.php
2 years ago
BoxShadow.php
4 years ago
ColumnWidth.php
4 years ago
CustomHeight.php
4 years ago
CustomSize.php
4 years ago
Gap.php
4 years ago
Height.php
4 years ago
JustifyContent.php
4 years ago
MaxWidth.php
4 years ago
MultipleImage.php
4 years ago
ObjectCss.php
4 years ago
Opacity.php
4 years ago
Property.php
4 years ago
PropertyBase.php
4 years ago
Size.php
4 years ago
Stroke.php
4 years ago
TBLR.php
4 years ago
TextShadow.php
4 years ago
Transform.php
2 years ago
Transition.php
4 years ago
Typography.php
2 years ago
UnitValuePercentage.php
4 years ago
UnitValuePx.php
4 years ago
ValueProxy.php
4 years ago
Width.php
4 years ago
BoxShadow.php
30 lines
| 1 | <?php |
| 2 | |
| 3 | |
| 4 | namespace Kubio\Core\StyleManager\Props; |
| 5 | |
| 6 | |
| 7 | use Kubio\Core\LodashBasic; |
| 8 | use Kubio\Core\StyleManager\ParserUtils; |
| 9 | use Kubio\Core\StyleManager\Utils; |
| 10 | use function join; |
| 11 | |
| 12 | class BoxShadow extends PropertyBase { |
| 13 | public function parse( $value, $options ) { |
| 14 | $enabled = LodashBasic::get( $value, 'enabled', false ); |
| 15 | if ( ! $enabled ) { |
| 16 | return array( |
| 17 | 'boxShadow' => 'none', |
| 18 | ); |
| 19 | } |
| 20 | |
| 21 | $layerDefault = LodashBasic::get( $this->config( 'default' ), 'layers.0', array() ); |
| 22 | $layer = LodashBasic::merge( $layerDefault, LodashBasic::get( $value, 'layers.0', array() ) ); |
| 23 | $style = array(); |
| 24 | if ( ParserUtils::areAllNonEmpty( LodashBasic::omit( $layer, 'inset' ) ) ) { |
| 25 | $style['boxShadow'] = join( ' ', array( "{$layer['x']}px", "{$layer['y']}px", "{$layer['blur']}px", "{$layer['spread']}px", $layer['color'], $layer['inset'] ) ); |
| 26 | } |
| 27 | return $style; |
| 28 | } |
| 29 | } |
| 30 |