Skip to content

Commit

Permalink
made the form pass thee ckeditor service to the form widget
Browse files Browse the repository at this point in the history
  • Loading branch information
ornicar committed Mar 7, 2010
1 parent 3d577d4 commit 11fde3c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 4 additions & 1 deletion lib/dmWidget/dmWidgetContentCkEditorForm.php
Expand Up @@ -7,7 +7,10 @@ public function configure()
{
parent::configure();

$this->widgetSchema['html'] = new sfWidgetFormTextareaDmCkEditor();
$this->widgetSchema['html'] = new sfWidgetFormTextareaDmCkEditor(array(
'ckeditor' => $this->getService('ckeditor')
));

$this->validatorSchema['html'] = new sfValidatorString();
}

Expand Down
8 changes: 7 additions & 1 deletion lib/widget/sfWidgetFormTextareaDmCkEditor.php
Expand Up @@ -20,6 +20,8 @@ protected function configure($options = array(), $attributes = array())

$this->setOption('config', array_merge($this->getDefaultConfig(), dmArray::get($options, 'config', array())));

$this->addOption('ckeditor');

return parent::configure($options, $attributes);
}

Expand Down Expand Up @@ -49,7 +51,11 @@ public function render($name, $value = null, $attributes = array(), $errors = ar
json_encode($this->getOption('config'))
));

$value = sfContext::getInstance()->get('ckeditor')->render($value);
if($ckEditor = $this->getOption('ckeditor'))
{
$value = $ckEditor->render($value);
}

return parent::render($name, $value, $attributes, $errors);
}

Expand Down

0 comments on commit 11fde3c

Please sign in to comment.