CBPViewHelper::getHtmlEditor

  1. Bitrix24 API (v. 23.675.0)
  2. bizproc
  3. CBPViewHelper
  4. getHtmlEditor
  • Модуль: bizproc
  • Путь к файлу: ~/bitrix/modules/bizproc/classes/general/viewhelper.php
  • Класс: CBPViewHelper
  • Вызов: CBPViewHelper::getHtmlEditor
static function getHtmlEditor($id, $fieldName, $content = '')
{
	$id = htmlspecialcharsbx($id);
	$fieldName = htmlspecialcharsbx($fieldName);

	if (is_array($content) && isset($content['TEXT']))
	{
		$content = $content['TEXT'];
	}

	$result = '';

	if (CModule::includeModule("fileman"))
	{
		$editor = new CHTMLEditor;
		$res = array(
			'useFileDialogs' => false,
			'height' => 200,
			'minBodyWidth' => 350,
			'normalBodyWidth' => 555,
			'bAllowPhp' => false,
			'limitPhpAccess' => false,
			'showTaskbars' => false,
			'showNodeNavi' => false,
			'askBeforeUnloadPage' => true,
			'bbCode' => false,
			'siteId' => SITE_ID,
			'autoResize' => true,
			'autoResizeOffset' => 40,
			'saveOnBlur' => true,
			'controlsMap' => array(
				array('id' => 'Bold',  'compact' => true, 'sort' => 80),
				array('id' => 'Italic',  'compact' => true, 'sort' => 90),
				array('id' => 'Underline',  'compact' => true, 'sort' => 100),
				array('id' => 'Strikeout',  'compact' => true, 'sort' => 110),
				array('id' => 'RemoveFormat',  'compact' => true, 'sort' => 120),
				array('id' => 'Color',  'compact' => true, 'sort' => 130),
				array('id' => 'FontSelector',  'compact' => false, 'sort' => 135),
				array('id' => 'FontSize',  'compact' => false, 'sort' => 140),
				array('separator' => true, 'compact' => false, 'sort' => 145),
				array('id' => 'OrderedList',  'compact' => true, 'sort' => 150),
				array('id' => 'UnorderedList',  'compact' => true, 'sort' => 160),
				array('id' => 'AlignList', 'compact' => false, 'sort' => 190),
				array('separator' => true, 'compact' => false, 'sort' => 200),
				array('id' => 'InsertLink',  'compact' => true, 'sort' => 210, 'wrap' => 'bx-b-link-'.$id),
				array('id' => 'InsertImage',  'compact' => false, 'sort' => 220),
				array('id' => 'InsertVideo',  'compact' => true, 'sort' => 230, 'wrap' => 'bx-b-video-'.$id),
				array('id' => 'InsertTable',  'compact' => false, 'sort' => 250),
				array('id' => 'Code',  'compact' => true, 'sort' => 260),
				array('id' => 'Quote',  'compact' => true, 'sort' => 270, 'wrap' => 'bx-b-quote-'.$id),
				array('id' => 'Smile',  'compact' => false, 'sort' => 280),
				array('separator' => true, 'compact' => false, 'sort' => 290),
				array('id' => 'Fullscreen',  'compact' => false, 'sort' => 310),
				array('id' => 'BbCode',  'compact' => true, 'sort' => 340),
				array('id' => 'More',  'compact' => true, 'sort' => 400)
			),

			'name' => $fieldName.'[TEXT]',
			'inputName' => $fieldName.'[TEXT]',
			'id' => $id,
			'width' => '100%',
			'content' => htmlspecialcharsback($content),
		);

		ob_start();
		echo '';
		$editor->show($res);
		$result = ob_get_contents();
		ob_end_clean();
	}

	return $result;
}

Добавить комментарий