public
Last active

CKEditor Helper for CakePHP v1.3.4

  • Download Gist
ck.php
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
<?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));
}
}
?>

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.