first commit
This commit is contained in:
29
class/smarty_plugins/modifier.inline_edit.php
Normal file
29
class/smarty_plugins/modifier.inline_edit.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Smarty plugin.
|
||||
*/
|
||||
use KupShop\ContentBundle\Util\InlineEdit;
|
||||
use KupShop\KupShopBundle\Util\Compat\ServiceContainer;
|
||||
|
||||
/**
|
||||
* Smarty {translate} function plugin.
|
||||
*/
|
||||
function smarty_modifier_inline_edit($block, $editable = true)
|
||||
{
|
||||
if (is_string($block) || is_null($block)) {
|
||||
return $block;
|
||||
}
|
||||
|
||||
/** @var InlineEdit $inlineEdit */
|
||||
$inlineEdit = ServiceContainer::getService(InlineEdit::class);
|
||||
$wrapped = $inlineEdit->wrapBlock($block);
|
||||
|
||||
if (!$editable && getAdminUser()) {
|
||||
return $wrapped['unwrapped_content'];
|
||||
}
|
||||
|
||||
if (isset($wrapped['content'])) {
|
||||
return $wrapped['content'];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user