public static function ckeditorOptions($controller, $options = [])
{
if (is_array($controller)) {
$id = $controller[0];
unset($controller[0]);
$params = $controller;
} else {
$id = $controller;
$params = [];
}
if (isset($params['startPath'])) {
$params['#'] = ElFinder::genPathHash($params['startPath']);
unset($params['startPath']);
}
return ArrayHelper::merge(['filebrowserBrowseUrl' => self::getManagerUrl($id, $params), 'filebrowserImageBrowseUrl' => self::getManagerUrl($id, ArrayHelper::merge($params, ['filter' => 'image'])), 'filebrowserFlashBrowseUrl' => self::getManagerUrl($id, ArrayHelper::merge($params, ['filter' => 'flash']))], $options);
}
/** * Executes the widget. * @return string the result of widget execution to be outputted. */ public function run() { $ckeditorOptions = []; if ($this->removeFirstTag) { $ckeditorOptions['enterMode'] = new JsExpression('CKEDITOR.ENTER_BR'); } $ckeditorOptions = ArrayHelper::merge($ckeditorOptions, $this->clientOptions); $options = ArrayHelper::merge(['initOnEvent' => 'focus', 'options' => ['class' => 'form-control form-redactor']], $this->options); $options['editorOptions'] = ElFinder::ckeditorOptions(Adm::getInstance()->id . '/elfinder', $ckeditorOptions); return $this->form->field($this->model, $this->attribute)->widget(CKEditor::className(), $options); }