Skip to content

Commit

Permalink
Test case for smarty-php/smarty#457
Browse files Browse the repository at this point in the history
  • Loading branch information
AnrDaemon committed Feb 20, 2020
1 parent 0ae2e5b commit 2331a04
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 1 deletion.
76 changes: 76 additions & 0 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 21 additions & 1 deletion testcase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,28 @@

require_once __DIR__ . '/smarty-config.php';

class SvgImage {
public function render($params, $smarty) {
$params += [
'id' => null,
'class' => null,
'style' => null,
'fallback' => null,
];
return "\$" . __CLASS__ . " = " . var_export($params, true);
}
}

$smarty->registerPlugin('function', 'svgImage', [new SvgImage('/img/cat/icon'), 'render'], true, [
'name', 'id', 'class', 'style', 'fallback'
]);

$smarty->display(__FILE__);

__HALT_COMPILER();
?>PHP: {$smarty.const.PHP_VERSION}
?>{svgImage name="icon"}

{svgImage name="icon" id="id" class="none" style="float: left;" fallback="text"}

PHP: {$smarty.const.PHP_VERSION}
Smarty: {$smarty.version}

0 comments on commit 2331a04

Please sign in to comment.