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
CustomHeight.php
36 lines
| 1 | <?php |
| 2 | |
| 3 | |
| 4 | namespace Kubio\Core\StyleManager\Props; |
| 5 | |
| 6 | use Kubio\Core\LodashBasic; |
| 7 | use Kubio\Core\StyleManager\ParserUtils; |
| 8 | use Kubio\Core\Styles\Utils; |
| 9 | use function array_keys; |
| 10 | |
| 11 | class CustomHeight extends PropertyBase { |
| 12 | public function parse( $value, $options ) { |
| 13 | $mergedValue = (object) $this->valueWithDefault( $value ); |
| 14 | |
| 15 | $types = $this->config( 'enums.types' ); |
| 16 | $typeToConst = array_flip( $types ); |
| 17 | |
| 18 | $typeConstName = $typeToConst[ $mergedValue->type ]; |
| 19 | |
| 20 | $cssByType = $this->config( 'config.cssByType' ); |
| 21 | $minHeights = $this->config( 'config.minHeightByType' ); |
| 22 | |
| 23 | if ( $typeConstName == 'MIN_HEIGHT' ) { |
| 24 | $minHeights['MIN_HEIGHT'] = $mergedValue->{$types['MIN_HEIGHT']}; |
| 25 | } |
| 26 | |
| 27 | $style = LodashBasic::get( $cssByType, $typeConstName, array() ); |
| 28 | |
| 29 | if ( isset( $minHeights[ $typeConstName ] ) ) { |
| 30 | ParserUtils::addValueUnitString( $style, 'min-height', $minHeights[ $typeConstName ] ); |
| 31 | } |
| 32 | |
| 33 | return $style; |
| 34 | } |
| 35 | } |
| 36 |