Releases: DevGroup-ru/bh-php
Releases · DevGroup-ru/bh-php
Unsafe attrs and cls
New BC-breaking feature added: ability to store unsafe(unescaped) values in attrs and cls.
Example of unsafe stuff:
<?php
$bemjson = [
'block' => 'myblock',
'cls' => [
'unsafe' => '<?= isset($item["red"])?"red":"" ?>',
],
'attrs' => [
'data-key' => [
'unsafe' => '<?= $key ?>',
],
],
];
echo $bh->apply($bemjson);
Will produce:
<div class="myblock <?= isset($item["red"])?"red":"" ?>" data-key="<?= $key ?>"></div>
Which is good for PHP-templates.