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;
}

Changelog

Changelog
Version Description
3.0.0 Introduced.


User Contributed Notes

You must log in before being able to contribute a note or feedback.