1. Go to this page and download the library: Download djozsef/yii2-kcfinder library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
djozsef / yii2-kcfinder example snippets
use iutbay\yii2kcfinder\KCFinderInputWidget;
echo KCFinderInputWidget::widget([
'name' => 'image',
]);
use iutbay\yii2kcfinder\KCFinderInputWidget;
echo $form->field($model, 'images')->widget(KCFinderInputWidget::className(), [
'multiple' => true,
]);
namespace app\widgets;
use yii\helpers\ArrayHelper;
use iutbay\yii2kcfinder\KCFinderAsset;
class CKEditor extends \dosamigos\ckeditor\CKEditor
{
public $enableKCFinder = true;
/**
* Registers CKEditor plugin
*/
protected function registerPlugin()
{
if ($this->enableKCFinder)
{
$this->registerKCFinder();
}
parent::registerPlugin();
}
/**
* Registers KCFinder
*/
protected function registerKCFinder()
{
$register = KCFinderAsset::register($this->view);
$kcfinderUrl = $register->baseUrl;
$browseOptions = [
'filebrowserBrowseUrl' => $kcfinderUrl . '/browse.php?opener=ckeditor&type=files',
'filebrowserUploadUrl' => $kcfinderUrl . '/upload.php?opener=ckeditor&type=files',
];
$this->clientOptions = ArrayHelper::merge($browseOptions, $this->clientOptions);
}
}