# ablocks/2.11.1/includes/blocks/spacer/block.php

aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder &amp; Animation Builder, version 2.11.1. 59 lines.

- Page: https://pluginprobe.com/plugins/ablocks/2.11.1/code/includes/blocks/spacer/block.php
- Raw: https://pluginprobe.com/plugins/ablocks/2.11.1/raw/includes/blocks/spacer/block.php
- Modified: 2025-12-28T14:24:12+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/ablocks/2.11.1/code/includes/blocks/spacer/block.php#L10-L20`.

```php
<?php

namespace ABlocks\Blocks\Spacer;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

use ABlocks\Classes\BlockBaseAbstract;
use ABlocks\Classes\CssGenerator;
use ABlocks\Classes\CssGeneratorV2;

class Block extends BlockBaseAbstract {
	protected $block_name = 'spacer';

	public function build_css_v1( $attributes ) {
		$css_generator = new CssGenerator( $attributes, $this->block_name );

		$css_generator->add_class_styles(
			'{{WRAPPER}} .ablocks-spacer__box',
			$this->get_spacer_css( $attributes ),
			$this->get_spacer_css( $attributes, 'Tablet' ),
			$this->get_spacer_css( $attributes, 'Mobile' ),
		);

		return $css_generator->generate_css();
	}
	public function build_css_v2( $attributes ) {
		$css_generator = new CssGeneratorV2( $attributes, $this->block_name );

		$css_generator->add_class_styles(
			'{{WRAPPER}} .ablocks-spacer__box',
			$this->get_spacer_css( $attributes ),
			$this->get_spacer_css( $attributes, 'Tablet' ),
			$this->get_spacer_css( $attributes, 'Mobile' ),
		);

		return $css_generator->generate_css();
	}
	public function build_css( $attributes ) {
		if ( isset( $attributes['blockVersion'] ) && (int) $attributes['blockVersion'] === 2 ) {
			return $this->build_css_v2( $attributes );
		}
		return $this->build_css_v1( $attributes );
	}
	public function get_spacer_css( $attributes, $device = '' ) {
		$spacer_css = [];
		$height = isset( $attributes['spacerHeight'] ) ? $attributes['spacerHeight'] : '';
		$height_key = 'value' . $device;

		if ( ! empty( $height[ $height_key ] ) ) {
			$value_unit = isset( $height['valueUnit'] ) ? $height['valueUnit'] : 'px';
			$spacer_css['height'] = $height[ $height_key ] . $value_unit . '!important';
		}

		return $spacer_css;
	}
}

```
