Skip to content

Commit a4836ad

Browse files
committed
✨ add head directive to plates
Signed-off-by: otengkwame <developerkwame@gmail.com>
1 parent 2c8b204 commit a4836ad

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

Core/core/View/Plates.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ class Plates
158158
'endunless',
159159
'includeIf',
160160
'include',
161+
'head',
161162
'partial',
162163
'section',
163164
'component',
@@ -1321,6 +1322,17 @@ protected function compile_include($content)
13211322
return preg_replace($pattern, '$1<?php echo $this->include$2; ?>', $content);
13221323
}
13231324

1325+
/**
1326+
* Rewrites Plates @head statement into valid PHP
1327+
*/
1328+
protected function compile_head(string $content): ?string
1329+
{
1330+
$pattern = '/(\s*)@head(\s*\(.*\))/';
1331+
1332+
return preg_replace($pattern, '$1<?php echo $this->partial$2; ?>', $content);
1333+
}
1334+
1335+
13241336
/**
13251337
* Rewrites Plates @partial statement into valid PHP
13261338
*

0 commit comments

Comments
 (0)