38 lines
793 B
PHP
38 lines
793 B
PHP
<?php
|
|
|
|
/**
|
|
* Smarty plugin.
|
|
*/
|
|
|
|
/**
|
|
* Smarty {insert_wysiwyg} plugin.
|
|
*
|
|
* Type: function<br>
|
|
* Name: url<br>
|
|
* Purpose: insert wysiwyg editor
|
|
*
|
|
* @param array $params parameters
|
|
* @param Smarty_Internal_Template $smarty template object
|
|
*
|
|
* @return string
|
|
*/
|
|
function smarty_function_insert_wysiwyg($params, $smarty)
|
|
{
|
|
static $index = 0;
|
|
|
|
$defaults = [
|
|
'type' => 'BasicTable',
|
|
'index' => $index,
|
|
];
|
|
|
|
$params = array_merge($defaults, $params);
|
|
|
|
if (empty($params['target'])) {
|
|
throw new InvalidArgumentException('insert_wysiwyg: \'target\' parameter empty');
|
|
}
|
|
|
|
echo $smarty->_subTemplateRender('utils/wysiwyg.tpl', $smarty->cache_id, $smarty->compile_id, 0, null, $params, 0, false);
|
|
|
|
$index++;
|
|
}
|