Skip to content

Commit a5d3eac

Browse files
authored
Merge pull request #65 from tlewap/patch-1
Added missing support alignContent
2 parents 4d3ecfc + c0331fa commit a5d3eac

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

docs/parameters.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ When creating blocks, you can include any of the following parameters.
1414
EnqueueScript:
1515
EnqueueAssets: (function callback)
1616
SupportsAlign: (space-separated)
17+
SupportsAlignContent: (true|matrix)
1718
SupportsAnchor: (true|false)
1819
SupportsCustomClassName: (true|false)
1920
SupportsMode: (true|false)

timber-acf-wp-blocks.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ public static function timber_block_init() {
7474
'align' => 'Align',
7575
'post_types' => 'PostTypes',
7676
'supports_align' => 'SupportsAlign',
77+
'supports_align_content' => 'SupportsAlignContent',
7778
'supports_mode' => 'SupportsMode',
7879
'supports_multiple' => 'SupportsMultiple',
7980
'supports_anchor' => 'SupportsAnchor',
@@ -128,6 +129,12 @@ public static function timber_block_init() {
128129
filter_var( $file_headers['supports_align'], FILTER_VALIDATE_BOOLEAN ) :
129130
explode( ' ', $file_headers['supports_align'] );
130131
}
132+
// If the SupportsAlignContent header is set in the template, restrict this block
133+
// to those aligns.
134+
if ( ! empty( $file_headers['supports_align_content'] ) ) {
135+
$data['supports']['alignContent'] = ('true' === $file_headers['supports_align_content']) ?
136+
true : (('matrix' === $file_headers['supports_align_content']) ? "matrix" : false);
137+
}
131138
// If the SupportsMode header is set in the template, restrict this block
132139
// mode feature.
133140
if ( ! empty( $file_headers['supports_mode'] ) ) {

0 commit comments

Comments
 (0)