Astra_Builder_Base_Dynamic_CSS::prepare_visibility_css( string $section_id, string $selector, string $default_property = 'flex', string $mobile_tablet_default = '' )

Prepare Element visibility Dynamic CSS.


Description


Parameters

$section_id

(string) (Required) section id.

$selector

(string) (Required) selector.

$default_property

(string) (Optional) Section default CSS property.

Default value: 'flex'

$mobile_tablet_default

(string) (Optional) Mobile/Tabled display property.

Default value: ''


Return

(array)


Source

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

		public static function prepare_visibility_css( $section_id, $selector, $default_property = 'flex', $mobile_tablet_default = '' ) {

			$css_output_desktop = array();
			$css_output_tablet  = array();
			$css_output_mobile  = array();

			// For Mobile/Tablet we need display grid property to display elements centerd alignment.
			$mobile_tablet_default = ( $mobile_tablet_default ) ? $mobile_tablet_default : $default_property;

			$hide_desktop = ( ! astra_get_option( $section_id . '-hide-desktop' ) ) ? $default_property : 'none';
			$hide_tablet  = ( ! astra_get_option( $section_id . '-hide-tablet' ) ) ? $mobile_tablet_default : 'none';
			$hide_mobile  = ( ! astra_get_option( $section_id . '-hide-mobile' ) ) ? $mobile_tablet_default : 'none';

			$css_output_desktop = array(
				$selector => array(
					'display' => $hide_desktop,
				),
			);

			$css_output_tablet = array(
				'.ast-header-break-point ' . $selector => array(
					'display' => $hide_tablet,
				),
			);

			$css_output_mobile = array(
				'.ast-header-break-point ' . $selector => array(
					'display' => $hide_mobile,
				),
			);

			/* Parse CSS from array() */
			$css_output  = astra_parse_css( $css_output_desktop );
			$css_output .= astra_parse_css( $css_output_tablet, '', astra_get_tablet_breakpoint() );
			$css_output .= astra_parse_css( $css_output_mobile, '', astra_get_mobile_breakpoint() );

			return $css_output;
		}


User Contributed Notes

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