Addon_Gutenberg_Editor_CSS::spacing_addon_gutenberg_dynamic_css( string $dynamic_css, string $dynamic_css_filtered = '' )

Dynamic CSS – Spacing Addon


Description


Parameters

$dynamic_css

(string) (Required) Astra Gutenberg Dynamic CSS.

$dynamic_css_filtered

(string) (Optional) Astra Gutenberg Dynamic CSS Filters.

Default value: ''


Return

(string)


Source

File: classes/class-addon-gutenberg-editor-css.php

		public function spacing_addon_gutenberg_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) {

			$container_layout = get_post_meta( get_the_id(), 'site-content-layout', true );
			if ( 'default' === $container_layout ) {
				$container_layout = astra_get_option( 'single-' . get_post_type() . '-content-layout' );

				if ( 'default' === $container_layout ) {
					$container_layout = astra_get_option( 'site-content-layout' );
				}
			}

			$boxed_container = array();

			if ( 'content-boxed-container' === $container_layout || 'boxed-container' === $container_layout ) {

				$continer_inside_spacing = astra_get_option( 'container-inside-spacing' );
				$site_content_width      = astra_get_option( 'site-content-width', 1200 );

				$boxed_container = array(

					'.block-editor-block-list__layout, .editor-post-title' => array(
						'padding-top'    => astra_responsive_spacing( $continer_inside_spacing, 'top', 'desktop' ),
						'padding-bottom' => astra_responsive_spacing( $continer_inside_spacing, 'bottom', 'desktop' ),
						'padding-left'   => astra_responsive_spacing( $continer_inside_spacing, 'left', 'desktop' ),
						'padding-right'  => astra_responsive_spacing( $continer_inside_spacing, 'right', 'desktop' ),
					),

					'.block-editor-writing-flow .block-editor-block-list__layout' => array(
						'padding-top' => '0',
					),

					'.editor-post-title'              => array(
						'padding-bottom' => '0',
					),

					'.block-editor-block-list__block' => array(
						'max-width' => 'calc(' . astra_get_css_value( $site_content_width, 'px' ) . ' - ' . astra_responsive_spacing( $continer_inside_spacing, 'left', 'desktop' ) . ')',
					),

					'.block-editor-block-list__layout .block-editor-block-list__block[data-align="full"] > .editor-block-list__block-edit' => array(
						'margin-left'  => - (int) astra_responsive_spacing( $continer_inside_spacing, 'left', 'desktop' ) . 'px',
						'margin-right' => - (int) astra_responsive_spacing( $continer_inside_spacing, 'right', 'desktop' ) . 'px',
					),

					'.block-editor-block-list__block[data-align=wide]' => array(
						'margin-left'  => '-' . ( 15 - (int) astra_responsive_spacing( $continer_inside_spacing, 'left', 'desktop' ) ) . 'px',
						'margin-right' => '-' . ( 15 - (int) astra_responsive_spacing( $continer_inside_spacing, 'right', 'desktop' ) ) . 'px',
					),

				);

				if ( '' !== astra_responsive_spacing( $continer_inside_spacing, 'left', 'desktop' ) ) {
					$boxed_container['.edit-post-visual-editor .block-editor-block-list__block .editor-block-list__block-edit, .editor-post-title__block .editor-post-title__input'] = array(
						'padding-left'  => 0,
						'padding-right' => 0,
					);
				}
			}

			$parse_css = astra_parse_css( $boxed_container );

			return $dynamic_css . $parse_css;
		}

Changelog

Changelog
Version Description
1.6.2 Introduced.


User Contributed Notes

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