Yii 1.1: ewymeditor

This extension is a wrapper for WYMeditor plugin which adds WYSIWYM editor.

EWYMeditor is an extension for Yii framework. This extension is a wrapper for WYMeditor which is a web-based WYSIWYM (What You See Is What You Mean) XHTML editor (not WYSIWYG).


  • Yii 1.1 or above (tested on 1.1.8)
  • jQuery
  • jQuery UI (for resizable plugin)


Move EWYMeditor folder in your applications extensions folder (default: protected/extensions).

Using extension

There are three ways to use this extension.

Least obstructive (great if you want to test this extension, you don't want change your view file or you have more than one input to apply this extension to) way is:

<?php $this->widget( 'ext.EWYMeditor.EWYMeditor', array(
  'target' => 'textarea',
)); ?>

Or you can use a model to create textarea:

<?php $this->widget( 'ext.EWYMeditor.EWYMeditor', array(
  'model' => $model, // Your model
  'attribute' => 'description', // Attribute for textarea
)); ?>

Or if you want to add textarea without model:

<?php $this->widget( 'ext.EWYMeditor.EWYMeditor', array(
  'name' => 'nameOfYourInput',
)); ?>

You will also need to add wymupdate class to your submit button or change the update selector. Update selector can be changed by providing updateSelector and updateEvent parameters to options array. For example you can create a submit button like this:

<?php echo CHtml::submitButton($model->isNewRecord ? 'Submit' : 'Save', array('class' => 'wymupdate')); ?>


You can change some default settings:

<?php $this->widget( 'ext.EWYMeditor.EWYMeditor', array(
  'target' => 'textarea',
  'plugins' => array( 'fullscreen', 'hovertools', 'tidy', 'resizable' ),
  'options' => array(
    'skin' => 'silver',
    // Check http://trac.wymeditor.org/trac/wiki/0.5/Customization for available options
)); ?>
  • target is jQuery selector for which elements to apply WYMeditor.
  • plugins a list of plugins to add to WYMeditor. Allowed options: fullscreen, hovertools, tidy, resizable. You can provided an array or comma delimited string (requires additional processing to convert to an array) for plugins parameter. If you use plugins and provide your own postInit through options, you will need to initialize plugins yourself.
  • options sets the options for WYMeditor. All available options can be found on WYMeditor customization.



  • Extension uses a modified JavaScript file which replaces the window popups with inline popups. If you want to use the original WYMeditor you will need to provide jQuery and other paths through options (not tested).

Total 4 comments

#6201 report it
ifdattic at 2011/12/19 08:42am

Great thing about being a programmer is what don't like something you can change it to your own needs :D

I was thinking about updating WYMeditor to the newest version, but after I saw they still use window popups decided to wait until they implement inline dialogs. I'm using a little bit different version of extension from that it's right now, but don't have the time to upload new changes. I will only probably take your update selector code :)

#5972 report it
Ben at 2011/12/01 04:00pm

Thanks for that extension! Just what I was searching for.

However, as always, I liked it to behave a little bit different. ;o)

So I...

  • updated the wymEditor lib to v1.0.0a (for no specific reason, simply liked it to be up-to-date)
  • modified the asset publishing (based on the widgets location instead of an alias)
  • introduced a new default updateSelector to get rid of the need to specify that css class marker

If you're interested in the changes, the fork is on github: https://github.com/bwoester/EWYMeditor

#4838 report it
ifdattic at 2011/08/20 02:24pm

Oh man, that's a big blunder on my side. And all the time then I was writing docs for extension I was thinking "don't forget to add that part about adding wymupdate class on your submit button", in the end memory likes making fun from me :D

Thanks for spotting this bug, I already updated the documentation for extension.

#4837 report it
jacmoe at 2011/08/20 02:07pm
Great work!

Nice extension. :)

There's a bug in it, however. You need to add 'wymupdate' class to the submit button, like this:

<?php echo CHtml::submitButton($model->isNewRecord ? 'Submit' : 'Save', array('class' => 'wymupdate')); ?>

If you don't, your changes won't get picked up by Yii. I am not sure how to integrate this into the extension, so I'm not going to create a patch on Github yet. :) Maybe later.

Leave a comment

Please to leave your comment.

Create extension