48 if (!isset($this->editorOptions[
'lang'])) {
49 $this->editorOptions[
'lang'] = substr(Yii::app()->getLanguage(), 0, 2);
52 if ($this->selector === null) {
53 list($this->name, $this->
id) = $this->resolveNameID();
54 $this->htmlOptions[
'id'] = $this->id;
55 $this->selector =
'#' . $this->id;
56 if (!array_key_exists(
'style', $this->htmlOptions)) {
57 $this->htmlOptions[
'style'] =
"width:{$this->width};height:{$this->height};";
59 if ($this->hasModel()) {
60 echo CHtml::activeTextArea($this->model, $this->attribute, $this->htmlOptions);
62 echo CHtml::textArea($this->name, $this->
value, $this->htmlOptions);
75 $assets->registerPackage(
'redactor');
77 $baseUrl = $assets->packages[
'redactor'][
'baseUrl'];
80 if ($this->editorOptions[
'lang'] !=
'en') {
81 $assets->registerScriptFile(
$baseUrl .
'/lang/' . $this->editorOptions[
'lang'] .
'.js');
84 if (isset($this->editorOptions[
'plugins'])) {
85 foreach ($this->editorOptions[
'plugins'] as $name) {
86 $filepath = Yii::getPathOfAlias(
'booster.assets.redactor.plugins') .
'/' . $name .
'/' . $name;
89 if (file_exists($filepath .
'.css'))
90 $assets->registerCssFile(
$url.
'.css');
92 if (file_exists($filepath .
'.js'))
93 $assets->registerScriptFile(
$url.
'.js');
97 $options = $this->editorOptions
98 ? CJavaScript::encode($this->editorOptions)
101 $assets->registerScript(
102 uniqid(__CLASS__ .
'#',
true),
103 "jQuery('{$this->selector}').redactor({$options});"