execut/yii2-kcfinder

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

KCFinder for Yii2

Installs: 656

Dependents: 2

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 19

Type:yii2-extension

0.2.1 2021-11-30 16:28 UTC

This package is auto-updated.

Last update: 2024-11-29 05:27:07 UTC


README

KCFinder for Yii2.

Installation

The preferred way to install this helper is through composer.

After, either run

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

or add

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

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

Widget Use

Without model :

use execut\yii2kcfinder\KCFinderInputWidget;

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

With model and ActiveForm :

use execut\yii2kcfinder\KCFinderInputWidget;

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

Use with 2amigos/yii2-ckeditor-widget

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

\execut\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);