WooCommerce Code Reference

Spacing_Preprocessor
in package
implements Preprocessor

This preprocessor is responsible for setting default spacing values for blocks.

In the early development phase, we are setting only margin-top for blocks that are not first or last in the columns block.

Interfaces, Classes and Traits

Preprocessor
Interface Preprocessor

Table of Contents

preprocess()  : array<string|int, mixed>
Preprocesses the parsed blocks.
add_block_gaps()  : array<string|int, mixed>
Adds margin-top to blocks that are not first or last in the columns block.

Methods

preprocess()

Preprocesses the parsed blocks.

public preprocess(array<string|int, mixed> $parsed_blocks, array<string|int, mixed> $layout, array<string|int, mixed> $styles) : array<string|int, mixed>
Parameters
$parsed_blocks : array<string|int, mixed>

Parsed blocks.

$layout : array<string|int, mixed>

Layout.

$styles : array<string|int, mixed>

Styles.

Return values
array<string|int, mixed>

add_block_gaps()

Adds margin-top to blocks that are not first or last in the columns block.

private add_block_gaps(array<string|int, mixed> $parsed_blocks[, string $gap = '' ][, array<string|int, mixed>|null $parent_block = null ]) : array<string|int, mixed>
Parameters
$parsed_blocks : array<string|int, mixed>

Parsed blocks.

$gap : string = ''

Gap.

$parent_block : array<string|int, mixed>|null = null

Parent block.

Return values
array<string|int, mixed>