2017 © Pedro Peláez
 

yii2-extension yii2-kcfinder

KCFinder for Yii2

image

djozsef/yii2-kcfinder

KCFinder for Yii2

  • Saturday, December 23, 2017
  • by djozsef
  • Repository
  • 1 Watchers
  • 0 Stars
  • 86 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 17 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

KCFinder for Yii2

KCFinder for Yii2., (*1)

WARNING : I don't have time actually to maintain this repository, but take a look here (WIP)..., (*2)

Installation

The preferred way to install this helper is through composer., (*3)

Since kcfinder package do not have stable release on packagist, you should use these settings in your composer.json file :, (*4)

"minimum-stability": "dev",
"prefer-stable": true,

After, either run, (*5)

php composer.phar require "iutbay/yii2-kcfinder" "dev-master"

or add, (*6)

"iutbay/yii2-kcfinder" : "dev-master"

to the require section of your application's composer.json file., (*7)

Widget Use

Without model :, (*8)

use iutbay\yii2kcfinder\KCFinderInputWidget;

echo KCFinderInputWidget::widget([
    'name' => 'image',
]);

With model and ActiveForm :, (*9)

use iutbay\yii2kcfinder\KCFinderInputWidget;

echo $form->field($model, 'images')->widget(KCFinderInputWidget::className(), [
    'multiple' => true,
]);

Use with 2amigos/yii2-ckeditor-widget

You should extend \dosamigos\ckeditor\CKEditor, e.g. :, (*10)

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);
    }

}

You should then set KCFinder options using session var, e.g. :, (*11)

// kcfinder options
// http://kcfinder.sunhater.com/install#dynamic
$kcfOptions = array_merge(KCFinder::$kcfDefaultOptions, [
    'uploadURL' => Yii::getAlias('@web').'/upload',
    'access' => [
        'files' => [
            'upload' => true,
            'delete' => false,
            'copy' => false,
            'move' => false,
            'rename' => false,
        ],
        'dirs' => [
            'create' => true,
            'delete' => false,
            'rename' => false,
        ],
    ],
]);

// Set kcfinder session options
Yii::$app->session->set('KCFINDER', $kcfOptions);

The Versions

23/12 2017
23/12 2017

dev-own-fork-setup

dev-own-fork-setup https://github.com/iutbay/yii2-kcfinder

KCFinder for Yii2

  Sources   Download

The Requires

 

by Kevin LEVRON

extension yii2 kcfinder

28/11 2014

0.0.1

0.0.1.0 https://github.com/iutbay/yii2-kcfinder

KCFinder for Yii2

  Sources   Download

The Requires

 

by Kevin LEVRON

extension yii2 kcfinder