Skip to content

Commit

Permalink
Merge branch 'release/1.0.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubmikita committed Mar 17, 2022
2 parents beeadbf + 1b5413f commit 0d73293
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# Changelog
All notable changes to this project will be documented in this file.

## 1.0.6

* [Added] Filers for block template and final markup.

## 1.0.5

* [Fixed] Invalid `micropackage/acf-block-creator/config` hookname
* [Added] Filters for block tamplate and style file paths
* [Added] Filters for block template and style file paths

## 1.0.4

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "micropackage/acf-block-creator",
"version": "1.0.5",
"version": "1.0.6",
"description": "ACF Block Creator - automatic block creation add-on for ACF",
"license": "GPL-3.0-or-later",
"authors": [
Expand Down
15 changes: 13 additions & 2 deletions src/ACFBlockCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,12 @@ public function update_field_group( $field_group ) {
$fields_markup[] = '<InnerBlocks />';
}

$template = $this->package_fs->get_contents( 'block.php' );
$template = apply_filters(
'micropackage/acf-block-creator/block/template',
$this->package_fs->get_contents( 'block.php' ),
$field_group
);

$template = str_replace(
[
'{COMMENT}',
Expand Down Expand Up @@ -292,9 +297,15 @@ public function update_field_group( $field_group ) {
return;
}

$markup = apply_filters(
'micropackage/acf-block-creator/block/markup',
preg_replace( '/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/', "\n\n", $template ),
$field_group
);

$this->root_fs->put_contents(
"{$template_dir}/{$template_file}",
preg_replace( '/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/', "\n\n", $template )
$markup
);

$scss_dir = apply_filters(
Expand Down

0 comments on commit 0d73293

Please sign in to comment.