AtkFckAttribute

From Achievo/ATK Wiki

Jump to: navigation, search

Attribute: atkFckAttribute

API docs | Flags

List of other attributes

File:AtkFckAttribute.png
atkFckAttribute screenshot

Contents

Description

The atkFckAttribute is a 'wysiwyg' text editor. It is a wrapper for the FckEditor from http://www.fckeditor.net. It is feature-rich and works in most popular browsers.

Params

The constructor of the atkFckAttribute has the following params:

atkFckAttribute($name, $size='', $flags=0,$opt=array())

  • name String
Name of the attribute (the same as the fieldname used in the database)
  • size int
Can be an array with cols and rows key for size and an autoadjust value or just the rows size
  • flags (optional) int
Flags for the attribute. For more information about flags, please checkout the flags section.
  • opt array
Extra fckeditor configuration options.

Examples

(in a node constructor):

$this->add(new atkFckAttribute("forum_reply_text"));

Adds a WYSIWYG field 'forum_reply_text' to the node.

Or a multilanguage example:

$this->add(new atkMlWrapper(new atkFckAttribute('text',array('rows'=>50,'cols'=>50),AF_SEARCHABLE,array('ToolbarSet'=>'Basic','Width'=>'600px','Height'=>'600px'))));

Toolbar

$attr->setToolbarSet('Basic');

With setToolbarSet it is possible to select the icons displayed on the toolbar. The 'Basic' set includes buttons for 'Bold','Italic','OrderedList','UnorderedList','Link','Unlink','About'.

Custom toolbarset

It is possible to specify a custom toolbarset by editting atk\attributes\fck\fckconfig.js, however, when you upgrade ATK, you would lose these changes.
A safer way is to copy the above mentioned file to somewhere in your application (that the browser can visit) and pass a 'CustomConfigurationsPath' to the FCK options, with the path (relative to the atkroot) where the fckconfig.js can be found.
Example:

$this->add(new atkFckAttribute('text',0,0,array('ToolbarSet'=>'Mine','CustomConfigurationsPath'=>'../javascript/customfckconfig.js')));

And add your custom 'Mine' toolbarset to your customfckconfig.js file.

Custom buttons

It is also possible to add custom buttons to the toolbar.

Personal tools
Navigation