# contact-forms/1.0/PFBC/Element/CKEditor.php

Contact Forms by Cimatti, version 1.0. 28 lines.

- Page: https://pluginprobe.com/plugins/contact-forms/1.0/code/PFBC/Element/CKEditor.php
- Raw: https://pluginprobe.com/plugins/contact-forms/1.0/raw/PFBC/Element/CKEditor.php
- Modified: 2013-07-25T16:57:42+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/contact-forms/1.0/code/PFBC/Element/CKEditor.php#L10-L20`.

```php
<?php
class Element_CKEditor extends Element_Textarea {
	protected $basic;

	function renderJS() {
		echo 'CKEDITOR.replace("', $this->attributes["id"], '"';
		if(!empty($this->basic))
			echo ', { toolbar: "Basic" }';
		echo ');';

		$ajax = $this->form->getAjax();
		$id = $this->form->getID();
		if(!empty($ajax)) {
			echo <<<JS
	jQuery("#$id").bind("submit", function() {
		CKEDITOR.instances["{$this->attributes["id"]}"].updateElement();
	});
JS;
		}
	}

	function getJSFiles() {
		return array(
			$this->form->getResourcesPath() . "/ckeditor/ckeditor.js"
		);
	}
}	

```
