Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
en:entwickler:javascript-editor_integrieren [2016/12/03 15:09] – codestyle and typos ximex | en:entwickler:javascript-editor_integrieren [2025/03/09 11:20] (current) – removed fasse | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Integrate JavaScript-Editor ====== | ||
- | With Admidio 2.3 the CKEditor is included as the standard. This can now be installed with simple methods in a script. | ||
- | |||
- | ===== Install editor in a form ===== | ||
- | The installation into a form has become very easy since version 3.0. | ||
- | Normally it should have been created with a form of class [[https:// | ||
- | <code php> | ||
- | Now you can at call the method at the appropriate place just with[[https:// | ||
- | <code php> | ||
- | |||
- | ===== Storing the contents ===== | ||
- | If the contents of the editor shall be saved about an object or derived object of **Table Access** - class, it must be deposited an exception in the methods **getValue** and **setValue** for the editor field. This prevents the HTML content is removed from the editor again. <code php> public function getValue($field_name, | ||
- | { | ||
- | if ($fieldName === ' | ||
- | { | ||
- | $value = $this-> | ||
- | } | ||
- | else | ||
- | { | ||
- | $value = parent:: | ||
- | } | ||
- | |||
- | return $value; | ||
- | } | ||
- | | ||
- | public function setValue($fieldName, | ||
- | { | ||
- | if ($fieldName === ' | ||
- | { | ||
- | return parent:: | ||
- | } | ||
- | return parent:: | ||
- | }</ | ||
- | | ||
- | ===== Validation of the HTML content ===== | ||
- | Because only HTML code is passed using the editor, this has yet to be validated before being stored in the database. For this purpose Admidio uses the script htmLawed. This must be integrated into the script that processes the inputs of the editor: <code php> | ||
- | |||
- | ===== Enable image upload ===== | ||
- | If the editor instance shall allow the upload of images, so it must be specified in the upload script a folder name for a folder within **adm_my_files**. Proceed this by calling the script **adm_program/ | ||
- | { | ||
- | $folderName = ' | ||
- | }</ | ||
- | |||
- | ===== Skip the HTML code-Check ===== | ||
- | The final step in the integration of the editor, the system-wide check of all passed variables for Html code must be deactivated for the id of the editor-field. For this purpose, the function **admStrStripTagsSpecial** must be supplemented. <code php>if ($key !== ' | ||
- | { | ||
- | $srcArray[$key] = strStripTags($value); | ||
- | }</ | ||
- | Each new ID will be supplemented with **&& | ||
- | The integration of the CKEditor for another form is finished! |