Astra_WP_Editor_CSS::astra_get_block_spacings()

Astra block editor block editor – padding preset CSS.


Description


Return

(array) Devices specific padding spacings.


Source

File: inc/core/class-astra-wp-editor-css.php

	public static function astra_get_block_spacings() {
		$wp_block_spacing_type     = astra_get_option( 'wp-blocks-ui' );
		$container_blocks_spacings = astra_get_option( 'wp-blocks-global-padding' );
		switch ( $wp_block_spacing_type ) {
			case 'compact':
				$desktop_top_block_space    = '2em';
				$desktop_right_block_space  = '2em';
				$desktop_bottom_block_space = '2em';
				$desktop_left_block_space   = '2em';
				$tablet_top_block_space     = '2em';
				$tablet_right_block_space   = '2em';
				$tablet_bottom_block_space  = '2em';
				$tablet_left_block_space    = '2em';
				$mobile_top_block_space     = '2em';
				$mobile_right_block_space   = '2em';
				$mobile_bottom_block_space  = '2em';
				$mobile_left_block_space    = '2em';
				break;
			case 'comfort':
				$desktop_top_block_space    = '3em';
				$desktop_right_block_space  = '3em';
				$desktop_bottom_block_space = '3em';
				$desktop_left_block_space   = '3em';
				$tablet_top_block_space     = '3em';
				$tablet_right_block_space   = '2em';
				$tablet_bottom_block_space  = '3em';
				$tablet_left_block_space    = '2em';
				$mobile_top_block_space     = '3em';
				$mobile_right_block_space   = '1.5em';
				$mobile_bottom_block_space  = '3em';
				$mobile_left_block_space    = '1.5em';
				break;
			case 'custom':
				$desktop_top_block_space    = astra_responsive_spacing( $container_blocks_spacings, 'top', 'desktop' );
				$desktop_right_block_space  = astra_responsive_spacing( $container_blocks_spacings, 'right', 'desktop' );
				$desktop_bottom_block_space = astra_responsive_spacing( $container_blocks_spacings, 'bottom', 'desktop' );
				$desktop_left_block_space   = astra_responsive_spacing( $container_blocks_spacings, 'left', 'desktop' );
				$tablet_top_block_space     = astra_responsive_spacing( $container_blocks_spacings, 'top', 'tablet' );
				$tablet_right_block_space   = astra_responsive_spacing( $container_blocks_spacings, 'right', 'tablet' );
				$tablet_bottom_block_space  = astra_responsive_spacing( $container_blocks_spacings, 'bottom', 'tablet' );
				$tablet_left_block_space    = astra_responsive_spacing( $container_blocks_spacings, 'left', 'tablet' );
				$mobile_top_block_space     = astra_responsive_spacing( $container_blocks_spacings, 'top', 'mobile' );
				$mobile_right_block_space   = astra_responsive_spacing( $container_blocks_spacings, 'right', 'mobile' );
				$mobile_bottom_block_space  = astra_responsive_spacing( $container_blocks_spacings, 'bottom', 'mobile' );
				$mobile_left_block_space    = astra_responsive_spacing( $container_blocks_spacings, 'left', 'mobile' );
				break;
			default:
				$desktop_top_block_space    = '';
				$desktop_right_block_space  = '';
				$desktop_bottom_block_space = '';
				$desktop_left_block_space   = '';
				$tablet_top_block_space     = '';
				$tablet_right_block_space   = '';
				$tablet_bottom_block_space  = '';
				$tablet_left_block_space    = '';
				$mobile_top_block_space     = '';
				$mobile_right_block_space   = '';
				$mobile_bottom_block_space  = '';
				$mobile_left_block_space    = '';
				break;
		}
		return array(
			'desktop' => array(
				'top'    => $desktop_top_block_space,
				'right'  => $desktop_right_block_space,
				'bottom' => $desktop_bottom_block_space,
				'left'   => $desktop_left_block_space,
			),
			'tablet'  => array(
				'top'    => $tablet_top_block_space,
				'right'  => $tablet_right_block_space,
				'bottom' => $tablet_bottom_block_space,
				'left'   => $tablet_left_block_space,
			),
			'mobile'  => array(
				'top'    => $mobile_top_block_space,
				'right'  => $mobile_right_block_space,
				'bottom' => $mobile_bottom_block_space,
				'left'   => $mobile_left_block_space,
			),
		);
	}

Changelog

Changelog
Version Description
3.8.3 Introduced.


User Contributed Notes

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