Created
July 8, 2016 08:54
-
-
Save devudit/3752b5e44d2c38e4947ba606239ef622 to your computer and use it in GitHub Desktop.
How to add ckeditor / wysiwyg editor in category description field in expression engine.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* | |
| * HOW TO:- | |
| * Here is simple accessories code for adding ckeditor / wysiwyg editor in category description field in expression engine. | |
| * create a directory as /system/expressionengine/third_party/eme_utills | |
| * create a accessories addon file like /system/expressionengine/third_party/eme_utills/acc.eme_utills.php | |
| * Now add the following code to it | |
| */ | |
| /** | |
| * EME UTILLS Accessory | |
| * Class EME_Utills_acc | |
| * @package EME_Utills | |
| * @category Accessory | |
| * @description Admin Modification | |
| * @author Udit Rawat | |
| * @link http://emerico.in | |
| */ | |
| class EME_Utills_acc | |
| { | |
| var $name = 'EME UTILLS Accessory'; | |
| var $id = 'eme_utills_acc'; | |
| var $version = '1.0'; | |
| var $description = 'Add wysiwyg editor to category description field By <a target="_blank" href="http://emerico.in">Emerico Web Solutions</a>'; | |
| var $sections = array(); | |
| /** | |
| * Constructor | |
| */ | |
| public function EME_Utills_acc() | |
| { | |
| $this->EE =& get_instance(); | |
| } | |
| /** | |
| * Section code | |
| */ | |
| public function set_sections() | |
| { | |
| $category_slug = $this->EE->uri->segment(3, 0); //category_edit | |
| $category_id = intval($this->EE->input->get('cat_id')); | |
| $this->sections[] = '<script type="text/javascript" charset="utf-8">$("#accessoryTabs a.eme_utills_acc").parent().remove();</script>'; | |
| if($category_slug == 'category_edit' && $category_id > 0) { | |
| ee()->cp->add_to_foot(' | |
| <script src="//cdn.ckeditor.com/4.5.9/standard/ckeditor.js"></script> | |
| <script type="text/javascript"> | |
| CKEDITOR.config.height = 150; | |
| CKEDITOR.config.width = \'auto\'; | |
| CKEDITOR.config.uiColor = \'#ECF1F4\'; | |
| CKEDITOR.config.extraAllowedContent = \'div(*)\'; | |
| CKEDITOR.replace( \'cat_description\' ); | |
| </script> | |
| '); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment