Created
October 9, 2010 12:24
-
-
Save damusnet/618139 to your computer and use it in GitHub Desktop.
CKEditor Helper for CakePHP v1.3.4
This file contains 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 | |
/** | |
* Helper CKEditor pour CakePHP v1.3.4 | |
* Code Original par Pierre-Emmanuel Fringant | |
* URL : http://www.formation-cakephp.com/388/ckeditor-helper | |
* Modifié par Damien Varron, 09/10/2010 | |
*/ | |
class CkHelper extends AppHelper | |
{ | |
var $helpers = array('Html', 'Js'); | |
function replace($fieldName, $options = array()) | |
{ | |
$defaults = array( | |
'customConfig' => '/js/ckeditor/app.config.js', | |
'loadFinder' => true | |
); | |
$options = array_merge($defaults, $options); | |
$fieldId = $this->domId($fieldName); | |
$loadFinder = $options['loadFinder']; | |
unset($options['loadFinder']); | |
$script = "\tvar ck_$fieldId = CKEDITOR.replace('$fieldId', {$this->Js->object($options)});"; | |
if($loadFinder) | |
{ | |
$script .= "\n\tCKFinder.setupCKEditor(ck_$fieldId, '/js/ckfinder/');"; | |
} | |
return $this->Html->scriptBlock($script, array('inline' => false)); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment