Astra_Addon_Base_Dynamic_CSS::prepare_box_shadow_dynamic_css( string $prefix, string $selector )

Dynamic CSS


Description


Parameters

$prefix

(string) (Required) control prefix.

$selector

(string) (Required) control CSS selector.


Return

(String) Generated dynamic CSS for Box Shadow.


Source

File: classes/builder/type/base/dynamic-css/class-astra-addon-base-dynamic-css.php

	public static function prepare_box_shadow_dynamic_css( $prefix, $selector ) {

		$dynamic_css = '';

		$box_shadow       = astra_get_option( $prefix . '-box-shadow-control' );
		$box_shadow_color = astra_get_option( $prefix . '-box-shadow-color' );
		$position         = astra_get_option( $prefix . '-box-shadow-position' );
		$is_shadow        = isset( $box_shadow );

		// Box Shadow.
		$box_shadow_x = ( $is_shadow && isset( $box_shadow['x'] ) && '' !== $box_shadow['x'] ) ? ( $box_shadow['x'] . 'px ' ) : '0px ';

		$box_shadow_y = ( $is_shadow && isset( $box_shadow['y'] ) && '' !== $box_shadow['y'] ) ? ( $box_shadow['y'] . 'px ' ) : '0px ';

		$box_shadow_blur = ( $is_shadow && isset( $box_shadow['blur'] ) && '' !== $box_shadow['blur'] ) ? ( $box_shadow['blur'] . 'px ' ) : '0px ';

		$box_shadow_spread = ( $is_shadow && isset( $box_shadow['spread'] ) && '' !== $box_shadow['spread'] ) ? ( $box_shadow['spread'] . 'px ' ) : '0px ';

		$shadow_position = ( $is_shadow && isset( $position ) && 'inset' === $position ) ? ' inset' : '';

		$shadow_color = ( isset( $box_shadow_color ) ? $box_shadow_color : 'rgba(0,0,0,0.5)' );

		$css_output = array(
			$selector => array(
				// box shadow.
				'box-shadow' => $box_shadow_x . $box_shadow_y . $box_shadow_blur . $box_shadow_spread . $shadow_color . $shadow_position,
			),
		);

		/* Parse CSS from array() */
		$dynamic_css .= astra_parse_css( $css_output );

		return $dynamic_css;
	}

Changelog

Changelog
Version Description
3.3.0 Introduced.


User Contributed Notes

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