birzha/modules/backend/formwidgets/RichEditor.php

72 lines
1.4 KiB
PHP
Raw Normal View History

2014-05-14 13:24:20 +00:00
<?php namespace Backend\FormWidgets;
use Backend\Classes\FormWidgetBase;
/**
* Rich Editor
* Renders a rich content editor field.
*
* @package october\backend
* @author Alexey Bobkov, Samuel Georges
*/
class RichEditor extends FormWidgetBase
{
//
// Configurable properties
//
/**
* @var boolean Determines whether content has HEAD and HTML tags.
*/
public $fullPage = false;
//
// Object properties
//
2014-05-14 13:24:20 +00:00
/**
* {@inheritDoc}
*/
2015-02-28 01:43:53 +00:00
protected $defaultAlias = 'richeditor';
2014-05-14 13:24:20 +00:00
/**
* {@inheritDoc}
*/
public function init()
{
$this->fillFromConfig([
'fullPage',
]);
}
2014-05-14 13:24:20 +00:00
/**
* {@inheritDoc}
*/
public function render()
{
$this->prepareVars();
return $this->makePartial('richeditor');
}
/**
* Prepares the list data
*/
public function prepareVars()
{
$this->vars['fullPage'] = $this->fullPage;
2014-05-14 13:24:20 +00:00
$this->vars['stretch'] = $this->formField->stretch;
$this->vars['size'] = $this->formField->size;
$this->vars['name'] = $this->formField->getName();
2015-01-04 22:45:04 +00:00
$this->vars['value'] = $this->getLoadValue();
2014-05-14 13:24:20 +00:00
}
/**
* {@inheritDoc}
*/
public function loadAssets()
{
2014-09-14 00:57:17 +00:00
$this->addCss('css/richeditor.css', 'core');
2015-02-14 05:40:50 +00:00
$this->addJs('js/build-min.js', 'core');
2014-09-14 00:57:17 +00:00
}
2014-10-10 21:50:05 +00:00
}