Source for file pnformbaselistselector.php
Documentation is available at pnformbaselistselector.php
* Base implementation for checkbox and dropdown list
* @copyright (c) 2006, Zikula Development Team
* @link http://www.zikula.org
* @version $Id: function.pnformdropdownlist.php 22138 2007-06-01 10:19:14Z markwest $
* @license GNU/GPL - http://www.gnu.org/copyleft/gpl.html
* @package Zikula_System_Modules
* Zikula Application Framework
* @copyright (c) 2007, Zikula Development Team
* @link http://www.zikula.org
* @version $Id: pnversion.php 19260 2006-06-12 13:08:15Z markwest $
* @license GNU/GPL - http://www.gnu.org/copyleft/gpl.html
* @package Zikula_System_Modules
* Enable or disable read only mode
* Data field name for looking up initial data
* The name stored here is used to lookup initial data for the plugin in the render's variables.
* The value itself depends on the plugin that extends this base class.
* Defaults to the ID of the plugin. See also tutorials on the Zikula site.
* Enable or disable use of $dataField
* Group name for this input
* The group name is used to locate data in the render (when databased) and to restrict which
* plugins to do validation on (to be implemented).
* @see pnFormRender::pnFormGetValues()
* @see pnFormRender::pnFormIsValid()
* Data field name for looking up initial item list
* The name stored here is used to lookup initial item list in the render's variables.
* The value should be an array as described for the $items variable.
* Defaults to the data field name concatenated with "Items". See also tutorials on the Zikula site.
* Validation indicator used by the framework.
* The true/false value of this variable indicates whether or not the list selection is valid.
* Enable or disable mandatory check
* Error message to display when selection does not validate
* Text label for this plugin
* This variable contains the label text for the input. The {@link pnFormLabel} plugin will set
* this text automatically when it is a label for this list.
* The list of selectable items
* This is an array of arrays like this:
* array( array('text' => 'A', 'value' => '1'),
* array('text' => 'B', 'value' => '2'),
* array('text' => 'C', 'value' => '3') )
* HTML input name for this plugin. Defaults to the ID of the plugin.
function create(&$render, $params)
$this->itemsDataField = (isset ($params['itemsDataField'])) ? $params['itemsDataField'] : $this->id . 'Items';
$render->pnFormAddValidator($this);
function load(&$render, &$params)
// The load function expects the plugin to read values from the render.
// This can be done with the loadValue function (which can be called in other situations than
// through the onLoad event).
$this->loadValue($render, $render->get_template_vars());
if ($this->group == null)
$data[$this->group] = array();
// Called internally by the plugin itself to load values from the render.
// Can also by called when some one is calling the render object's pnFormSetValues
if ($this->group == null)
if (isset ($values[$this->group]))
$data = $values[$this->group];
// To be implemented by extending class
// To be implemented by extending class
$item = array('text' => $text, 'value' => $value);
// Quicker than copying the items one by one
// If addItem() does som special logic in the future then call that for each element in $items
|