Plugin Basics Creating an e107 plugin


This will summarize the various options which may be used while utilizing the admin-ui class. Please note that the documentation for this is a work-in-progress. Thank you for your patience.


Database fields are defined by the $fields value in the admin-ui class. Example:

protected $fields = array(
      'myfield_id'  => array("title"=>"My Title", "type"=>"text", "data"=>"str", "width"=>"auto", "inline"=>true)
     // .....
Key Format Description
title string Field Title
type string Type of Field
data string Data Type
width string width of the column (List View)
inline boolean | string  Enable or disable inline editing.
help string  Popup helper text (tooltip)
readParms array  Parameters specific to the 'list' mode.
writeParms array  Parameters specific to the 'edit' and 'create' modes.


Type Description
text text box
number text box (number)
checkbox checkbox (0 or 1 is returned)
icon icon (from media manager)
textarea text area (text only)
boolean radio buttons with enable/disable
bbarea right text area (html)
dropdown dropdown list (ie. <select></select> )
userclass drop-down list of userclasses
userclasses checkboxes for multiple userclasses
datestamp date / time text box
user user selection text box. (type 3 letters to find/search)
hidden hidden field
ip text field with ip decoding
email text field for email addresses
url text field for urls (becomes clickable in list mode)
password password field (with optional generator)
image Media-manager image selection tool for a single image
images Media-manager image selection tool for multiple images
file Media-manager file selection tool for a single file
files Media-manager file selection tool for multiple files
method custom method
lanlist drop-down list of installed languages
language drop-down list of all languages
templates Dropdown list of templates (from a template file)
null (without quotes) Ignore this field and do not save it's data
false (without quotes) Hide this field but save it's data if a posted key value is found.


Value Description
str Posted data is converted to string before saving to the database
int Posted data is converted to integer before saving to the database
array Posted data is converted to an e107 array format. (use e107::unserialize() to decode)
json Posted data is converted to json format before saving to the database
false (no quotes) Posted data from this field is not saved to the database


readParms (list mode)

Key Value Field-type Comments
thumb (integer)  image  Set the thumbnail width
 url  (string)  e_url.php key value or a field key.  number, text, tags, null  Wrap value in a link
 target  (string) blank | dialog  number, text, tags, null  Target for 'url' above.


writeParms (create/edit mode)

Key Value Field-type Comments
pre (html) (all) Render html just before the field
post (html) (all) Render html just after the field
media (string) bbarea Sets the media-owner category to be used by the media-manager
video 0 or 1 images Show video selector tab in media-manager
glyphs 0 or 1 icon Show glyph selector tab in media-manager
size large, xlarge, xxlarge, block-level  text, url, email, textarea, dropdown Set the size (width) of input field
optArray (array of key=>value pairs) dropdown, checkboxes Set the keys/values to be used in the dropdown or checkboxes.
placeholder (string) text, url, email, textarea Placeholder text
pattern (regexp) text, url, email Regular expression validation
type date or datetime datestamp Choose between date or date and time
readonly 0 or 1 datestamp Make element read-only
auto 0 or 1 datestamp Insert current date/time automatically
inverse 0 or 1 boolean Invert the values of 0 and 1. ie. "Disabled" = 1 and "Enabled" = 0.
enabled (string) boolean Alternate text to replace "Enabled"
disabled (string) boolean Alternate text to replace "Disabled"
classlist public, guest, nobody, member, admin, main, classes
(comma separated)
userclass Set which userclasses should be displayed.
tdClassLeft (string) (all) Set the css class for the left-side table cell.
tdClassRight (string) (all) Set the css class for the right-side table cell.
trClass (string) (all) Set the css class for the table row.
nolabel 0 or 1 (all) Hide the left table cell

Creating a tree structure

The admin UI allows to automatically create a tree structure based on parent/child relationship tables. Examples can be found in the forum and download plugin. In order to add a tree structure, add the following code:

 protected $sortField  = 'field1';
 protected $sortParent = 'field2';
 protected $treePrefix = 'field3';

In this case, field1 represents the fields which determines the order (for example an ID field). The 'field2' represents the field which is the parent and 'field3' the child. For example:

 protected $sortField  = 'download_category_order';
 protected $sortParent = 'download_category_parent';
 protected $treePrefix = 'download_category_name';

Thursday 30 March 2017 - 14:41:00 Tijn Kuyper,