PHPackages                             insthync/yii2-ckeditor-widget - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. insthync/yii2-ckeditor-widget

ActiveYii2-extension

insthync/yii2-ckeditor-widget
=============================

CKEditor widget for Yii2 (Forked from https://github.com/2amigos/yii2-ckeditor-widget to update for latest Yii2)

012PHP

Since Oct 26Pushed 2y agoCompare

[ Source](https://github.com/insthync/yii2-ckeditor-widget)[ Packagist](https://packagist.org/packages/insthync/yii2-ckeditor-widget)[ RSS](/packages/insthync-yii2-ckeditor-widget/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

CKEditor Widget for Yii2
========================

[](#ckeditor-widget-for-yii2)

Renders a [CKEditor WYSIWYG text editor plugin](http://www.ckeditor.com) widget.

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
composer require insthync/yii2-ckeditor-widget:dev-master

```

or add

```
"insthync/yii2-ckeditor-widget" : "dev-master"
```

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

Skins &amp; Plugins
-------------------

[](#skins--plugins)

This widget works with default's `dev-full/stable` branch of CKEditor, with a set of plugins and skins. If you wish to configure a different skins or plugins that the one proposed, you will have to download them separately and configure the widget's `clientOptions` attribute accordingly.

Usage
-----

[](#usage)

The library comes with two widgets: `CKEditor` and `CKEditorInline`. One is for classic edition and the other for inline editing respectively.

Using a model with a basic preset:

```

use dosamigos\ckeditor\CKEditor;

```

Using inline edition with basic preset:

```

use dosamigos\ckeditor\CKEditorInline;

    This text can be edited now :)

```

How to add custom plugins
-------------------------

[](#how-to-add-custom-plugins)

This is the way to add custom plugins to the editor. Since version 2.0 we are working with the packagist version of the CKEditor library, therefore we are required to use its configuration API in order to add external plugins.

Lets add the popular [Code Editor Plugin](http://ckeditor.com/addon/pbckcode) for example. This plugin would allow us to add a button to our editor's toolbar so we can add code to the content we are editing.

Assuming you have downloaded the plugin and added to the root directory of your Yii2 site. I have it this way:

```
+ frontend
+ -- web
    + -- pbckcode
```

We can now add it to our CKEditor widget. For this example I am using `CKEditorInline` widget. One thing you notice on this example is that we do not use the preset attribute; this is highly important as we want to add a customized toolbar to our widget. No more talking, here is the code:

```
