Xataface CKeditor Module 0.3
CKeditor Widget for Xataface
|
This module adds an html editor widget that uses CKeditor to the set of widgets that can be used in a Xataface application. CKeditor is the successor of the FCKeditor project, which is included standard as part of the Xataface installation. The future of Xataface development is planned as modules so FCKeditor will continue to be used as the default editor for the htmlarea
widget type. The CKeditor widget can be specified for any field by setting widget:type=ckeditor
.
Installing the CKeditor module involves 2 steps:
modules_ckeditor=modules/ckeditor/ckeditor.php
At this point you should be able to use the ckeditor widget in your application.
Once the module has been installed, you can specify that a field use the CKeditor widget by setting its widget:type
directive to "ckeditor" in the fields.ini file. E.g.
[myfield] widget:type=ckeditor
Now when you load up the edit form for that table, you should see a ckeditor widget for editing the myfield field.
CKeditor supports a many configuration options for setting such things as where the toolbar should appear and which buttons should be present on the toolbar. A full list of these options can be found at http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html
Many of these options can be specified in the fields.ini file by setting:
widget:ckeditor:<configOption>=<configValue>
e.g.
widget:ckeditor:uiColor="#AADC6E"
You can also customize the configuration of a CKEditor instance on a per-record basis by implementing the ckeditor_decorateConfig() method in the delegate class.
e.g.
The following example sets the baseHref property of the editor be based on the record that is being edited.
function ckeditor_decorateConfig($record, &$config){ $site = df_get_record('settings', array('settings_id'=>$record->val('settings_id') )); if ( $site ){ $path = $record->val('webpage_url'); if ( $path{strlen($path)-1} != '/' ){ if ( strpos($path, '/') !== false ){ $parts = explode('/', $path); array_pop($parts); $path = implode('/', $parts); } else { $path = ''; } $path .= '/'; } $baseurl = $site->val('website_url').$path; $config['baseHref'] = $baseurl; } }