Skip to content

Commit

Permalink
Align support for issue MWDelaney#24
Browse files Browse the repository at this point in the history
Also added is_preview class to the block classes
  • Loading branch information
Luuk van de Scheur committed Sep 2, 2019
1 parent 7d62720 commit 42888b4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion sage-acf-gutenberg-blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
'icon' => $file_headers['icon'],
'keywords' => explode(' ', $file_headers['keywords']),
'mode' => $file_headers['mode'],
'align' => $file_headers['align'],
'render_callback' => __NAMESPACE__.'\\sage_blocks_callback',
'enqueue_style' => $file_headers['enqueue_style'],
'enqueue_script' => $file_headers['enqueue_script'],
Expand Down Expand Up @@ -144,7 +145,12 @@ function sage_blocks_callback($block, $content = '', $is_preview = false, $post_
$block['content'] = $content;
$block['slug'] = $slug;
// Send classes as array to filter for easy manipulation.
$block['classes'] = [$slug, $block['className'], 'align'.$block['align']];
$block['classes'] = [
$slug,
$block['className'],
$block['is_preview'] ? 'is-preview' : null,
'align'.$block['align']
];

// Filter the block data.
$block = apply_filters("sage/blocks/$slug/data", $block);
Expand Down

0 comments on commit 42888b4

Please sign in to comment.