Download the PHP package sjaakp/yii2-wysiwyg without Composer
On this page you can find all versions of the php package sjaakp/yii2-wysiwyg. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package yii2-wysiwyg
Yii2-wysiwyg
Redactor editor for Yii 2.x
This is a wrapper for the excellent Imperavi Redactor 'What-you-see-is-what-you-get' editor for the Yii 2.0 PHP Framework. It automatically loads any Redactor plugin needed.
A demonstration of yii2-wysiwyg is here.
Installation
The preferred way to install yii2-wysiwyg is through Composer.
Either add the following to the require section of your composer.json
file:
"sjaakp/yii2-wysiwyg": "*"
Or run:
composer require sjaakp/yii2-wysiwyg "*"
You can manually install yii2-wysiwyg by downloading the source in ZIP-format.
Redactor files
Redactor is proprietry software and is not available via Composer. You have to download it manually.
Yii2-wysiwyg assumes that the Redactor files (that is, the complete contents of
the 'redactor'
directory in the ZIP-file you get from Imperavi) live in '@app/redactor'
.
You can set another source path by setting parameter 'redactor'
in the application configuration file, usually called web.php
or main.php
in the config
directory, like so:
$params = [
'adminEmail' => ...,
'redactor' => <path to Redactor files, or alias>
];
$config = [
// ...
'params' => $params,
// ...
]
The path can and will most likely be set as an alias.
Using Wysiwyg
Wysiwyg is just an ordinary Yii 2 InputWidget. In a form, it can be used like this:
... other fields ...
<?= $form->field($model, 'story')->widget(Wysiwyg::class, [
// ... Wysiwyg options ...
]) ?>
... more fields ...
Like any InputWidget, Wysiwyg can also be used outside a form. In that case, it should be
associated with a name
and a value
:
<?= Wysiwyg::widget([
'name' => 'myWysiwyg',
'value' => 'Initial text...',
// ... other options ...
]) ?>
Options
Wysiwyg has al the properties of an InputWidget, plus the following:
- redactorOptions
array
the options for the Imperavi Redactor.Refer to the Imperavi Web page for possible options. There are lots of them!- includeCss
bool
whether CSS files should be registered. Set this to false in case you include the CSS in the sites main file.
- includeCss