Skip to content

Commit 312699f

Browse files
committed
expression tokens
1 parent dd5c4e3 commit 312699f

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

config/directives.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
<?php
22
/**
3-
*
3+
* Available Tokens:
4+
* {expression} includes parentheses, e.g ('user')
5+
* {expr} without parentheses, e.g 'user'
6+
* {var} variable name, e.g user
47
*/
58

69
use View5\Template;
10+
use View5\Token\Expression as Expr;
711

812
return [
913
'auth' => '<?php ${var} = $this->plugin({expr}); if (${var}->authenticated()) : ?>',
1014
'endAuth' => '<?php endif; ?>',
11-
/*'endAuth' => function(string $expression, Template $template) : string {
12-
return '<?php endif; ?>';
15+
/*'auth' => function(string $expression, Template $template) : string {
16+
$var = Expr::var($expression); $plugin = Expr::expr($expression);
17+
return '<?php $' . $var . ' = $this->plugin(' . $plugin . '); if ($' . $var . '->authenticated()) : ?>';
1318
},*/
1419
];

0 commit comments

Comments
 (0)