Skip to content

Commit 7ac7ffe

Browse files
committed
Fixing allowed block types helper for forms
1 parent 6bed836 commit 7ac7ffe

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
44

55
This projects adheres to [Semantic Versioning](https://semver.org/) and [Keep a CHANGELOG](https://keepachangelog.com/).
66

7+
## [10.3.0]
8+
9+
### Fixed
10+
11+
- Allowed blocks for forms broken on the WP 6.8 version.
12+
713
## [10.2.0]
814

915
### Added
@@ -847,6 +853,7 @@ Init setup
847853
- Gutenberg Blocks Registration.
848854
- Assets Manifest data.
849855

856+
[10.3.0]: https://github.com/infinum/eightshift-libs/compare/10.2.0...10.3.0
850857
[10.2.0]: https://github.com/infinum/eightshift-libs/compare/10.1.0...10.2.0
851858
[10.1.0]: https://github.com/infinum/eightshift-libs/compare/10.0.0...10.1.0
852859
[10.0.0]: https://github.com/infinum/eightshift-libs/compare/9.3.5...10.0.0

src/Blocks/AbstractBlocks.php

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,6 @@ public function addThemeSupport(): void
6161
*/
6262
public function getAllAllowedBlocksList($allowedBlockTypes, WP_Block_Editor_Context $blockEditorContext)
6363
{
64-
// Allow forms to be used correctly.
65-
if (
66-
$blockEditorContext->post instanceof WP_Post &&
67-
!empty($blockEditorContext->post->post_type) &&
68-
$blockEditorContext->post->post_type === 'eightshift-forms'
69-
) {
70-
return true;
71-
}
72-
7364
if (\is_bool($allowedBlockTypes)) {
7465
return $allowedBlockTypes;
7566
}
@@ -79,15 +70,14 @@ public function getAllAllowedBlocksList($allowedBlockTypes, WP_Block_Editor_Cont
7970
if ($blocks) {
8071
$allowedBlockTypes = \array_values(\array_merge(
8172
\array_map(
82-
fn ($block) => $block['blockFullName'],
73+
fn($block) => $block['blockFullName'],
8374
$blocks
8475
),
8576
$allowedBlockTypes,
8677
));
8778
}
8879

8980
// Allow reusable block.
90-
$allowedBlockTypes[] = 'eightshift-forms/forms';
9181
$allowedBlockTypes[] = 'core/block';
9282
$allowedBlockTypes[] = 'core/template';
9383

@@ -136,7 +126,7 @@ public function registerBlocks(): void
136126
public function render(array $attributes, string $innerBlockContent): string
137127
{
138128
// Get block view path.
139-
$blockOutpout = Helpers::render(
129+
$blockOutput = Helpers::render(
140130
$attributes['blockName'] ?? '',
141131
$attributes,
142132
'blocks',
@@ -153,11 +143,11 @@ public function render(array $attributes, string $innerBlockContent): string
153143
'wrapper',
154144
false,
155145
'',
156-
$blockOutpout
146+
$blockOutput
157147
);
158148
}
159149

160-
return $blockOutpout;
150+
return $blockOutput;
161151
}
162152

163153
/**

0 commit comments

Comments
 (0)