-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathAbstractBladeBlock.php
42 lines (34 loc) · 1.02 KB
/
AbstractBladeBlock.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
declare(strict_types=1);
namespace Itineris\AcfGutenblocks;
use function App\template;
abstract class AbstractBladeBlock extends Block implements InitializableInterface
{
public function fileExtension(): string
{
return '.blade.php';
}
public function isValid(): bool
{
return function_exists('\App\template');
}
public function renderBlockCallback(array $block): void
{
$frontend = apply_filters(
'acf_gutenblocks/render_block_frontend_path',
"{$this->dir}/views/frontend{$this->fileExtension()}",
$this
);
$block['slug'] = str_replace('acf/', '', $block['name']);
$block['classes'] = Util::sanitizeHtmlClasses([
$block['slug'],
$block['className'],
$block['align'],
]);
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
echo template($frontend, [
'block' => $block,
'controller' => $this,
]);
}
}