Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

Commit

Permalink
fix broken code
Browse files Browse the repository at this point in the history
  • Loading branch information
arrilot committed Mar 15, 2018
1 parent 8d0d2d9 commit 1142a2a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 deletions.
33 changes: 18 additions & 15 deletions src/BladeProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,13 @@ protected static function registerBitrixDirectives()
return '<?php $APPLICATION->IncludeComponent('.$expression.'); ?>';
});

$compiler->directive('bxComponent', function ($expression) {
$expression = rtrim($expression, ')');
$expression = ltrim($expression, '(');

return '<?php $APPLICATION->IncludeComponent('.$expression.'); ?>';
});

$compiler->directive('block', function ($expression) {
$expression = rtrim($expression, ')');
$expression = ltrim($expression, '(');
Expand Down Expand Up @@ -223,18 +230,6 @@ protected static function registerBitrixDirectives()
private static function registerHermitageDirectives($compiler)
{
$simpleDirectives = [
'actionEditIBlockElement' => 'editIBlockElement',
'actionDeleteIBlockElement' => 'deleteIBlockElement',
'actionEditAndDeleteIBlockElement' => 'editAndDeleteIBlockElement',

'actionEditIBlockSection' => 'editIBlockSection',
'actionDeleteIBlockSection' => 'deleteIBlockSection',
'actionEditAndDeleteIBlockSection' => 'editAndDeleteIBlockSection',

'actionEditHLBlockElement' => 'editHLBlockElement',
'actionDeleteHLBlockElement' => 'deleteHLBlockElement',
'actionEditAndDeleteHLBlockElement' => 'editAndDeleteHLBlockElement',

'actionAddForIBlock' => 'addForIBlock',
];
foreach ($simpleDirectives as $directive => $action) {
Expand All @@ -246,9 +241,17 @@ private static function registerHermitageDirectives($compiler)
}

$echoDirectives = [
'actionAreaForIBlockElement' => 'areaForIBlockElement',
'actionAreaForIBlockSection' => 'areaForIBlockSection',
'actionAreaForHLBlockElement' => 'areaForHLBlockElement',
'actionEditIBlockElement' => 'editIBlockElement',
'actionDeleteIBlockElement' => 'deleteIBlockElement',
'actionEditAndDeleteIBlockElement' => 'editAndDeleteIBlockElement',

'actionEditIBlockSection' => 'editIBlockSection',
'actionDeleteIBlockSection' => 'deleteIBlockSection',
'actionEditAndDeleteIBlockSection' => 'editAndDeleteIBlockSection',

'actionEditHLBlockElement' => 'editHLBlockElement',
'actionDeleteHLBlockElement' => 'deleteHLBlockElement',
'actionEditAndDeleteHLBlockElement' => 'editAndDeleteHLBlockElement',
];
foreach ($echoDirectives as $directive => $action) {
$compiler->directive($directive, function ($expression) use ($action) {
Expand Down
4 changes: 2 additions & 2 deletions src/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ function renderBladeTemplate($templateFile, $arResult, $arParams, $arLangMessage
Bitrix\Main\Localization\Loc::loadMessages($_SERVER['DOCUMENT_ROOT'].$templateFolder.'/template.php');

$view = BladeProvider::getViewFactory();

BladeProvider::addTemplateFolderToViewPaths($template->__folder);

global $APPLICATION, $USER;

echo $view->file($_SERVER['DOCUMENT_ROOT'].$templateFile, compact(
Expand Down

0 comments on commit 1142a2a

Please sign in to comment.