execut/yii2-kcfinder

There is no license information available for the latest version (0.1.5) of this package.

KCFinder for Yii2

Installs: 159

Dependents: 2

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 20

Type:yii2-extension

0.1.5 2019-12-03 12:59 UTC

This package is auto-updated.

Last update: 2020-03-03 13:35:16 UTC


README

KCFinder for Yii2.

Installation

The preferred way to install this helper is through composer.

After, either run

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

or add

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

to the require section of your application's composer.json file.

Widget Use

Without model :

use iutbay\yii2kcfinder\KCFinderInputWidget;

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

With model and ActiveForm :

use iutbay\yii2kcfinder\KCFinderInputWidget;

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

Use with 2amigos/yii2-ckeditor-widget

You should use extended CKEditor widget iutbay\yii2kcfinder\CKEditor, e.g. :

\iutbay\yii2kcfinder\CKEditor::widget();

Widget has enableKCFinder option for enable\disable KCFinder.

You should then set KCFinder options using session var, e.g. :

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