astra_calculate_spacing( array $value, string $operation = '', string $from = '', string $from_unit = '' )
Get Spacing value
Description
Parameters
- $value
-
(array) (Required) Responsive spacing value with unit.
- $operation
-
(string) (Optional) + | - |
* | /.Default value: ''
- $from
-
(string) (Optional) Perform operation from the value.
Default value: ''
- $from_unit
-
(string) (Optional) Perform operation from the value of unit.
Default value: ''
Return
(mixed)
Source
File: inc/extras.php
function astra_calculate_spacing( $value, $operation = '', $from = '', $from_unit = '' ) { $css = ''; if ( ! empty( $value ) ) { $css = $value; if ( ! empty( $operation ) && ! empty( $from ) ) { if ( ! empty( $from_unit ) ) { $css = 'calc( ' . $value . ' ' . $operation . ' ' . $from . $from_unit . ' )'; } if ( '*' === $operation || '/' === $operation ) { $css = 'calc( ' . $value . ' ' . $operation . ' ' . $from . ' )'; } } } return $css; }
Expand full source code Collapse full source code View on Trac
Changelog
Version | Description |
---|---|
3.0.0 | Introduced. |