/** * Creates a new optionset field. * @param name The field name * @param title The field title * @param source An map of the dropdown items * @param extra An map of label (DBField's name) => classname (DBField's class) for extra field * @param value The current value * @param extraValue The current extraValues * @param form The parent form */ function __construct($name, $title = "", $source = array(), $extra = array(), $value = "", $extraValue = array(), $form = null) { if (!empty($extra)) { $this->extra = $extra; } if (!empty($extraValue)) { $this->extraValue = $extraValue; } parent::__construct($name, $title, $source, $value, $form); }
/** * Constructor * * @param string $name * @param string $title * @param SS_List $source * @param string $labelField * @param string $idField * @param string $value * @param Form $form */ public function __construct($name, $title = null, $source = null, $labelField = 'Title', $idField = 'ID', $value = '', $form = null) { if ($source && !$source instanceof SS_List) { throw new Exception("BootstrapTagField::__construct() -- \$source must be an SS_List"); } else { if (!$source) { $source = ArrayList::create(); } } $this->labelField = $labelField; $this->idField = $idField; parent::__construct($name, $title, $source, $value, $form); }
function __construct($name, $title = null, $source = null, $value = "", $form = null, $emptyString = null) { if (!$source) { $source = array(); } if (is_string($source)) { // it should be the name of a list, lets get all its contents $dynamicList = DataObject::get_one('DynamicList', '"Title" = \'' . Convert::raw2sql($source) . '\''); $source = array(); if ($dynamicList) { $items = $dynamicList->Items(); foreach ($items as $item) { $source[$item->Title] = $item->Title; } } } parent::__construct($name, $title, $source, $value, $form, $emptyString); }
public function __construct($name, $title = null, $source = array(), $value = '', $form = null, $emptyString = null) { parent::__construct($name, $title, $source, $value, $form, $emptyString); $this->other_text = _t('CheckboxSetOtherField.OTHER', 'Other (please specify)'); }
function __construct($name, $title = "", $source = array(), $childsource = null, $value = "", $form = null, $childfilter = null) { parent::__construct($name, $title, $source, $value, $form); $this->childsource = $childsource; $this->childfilter = $childfilter; }
/** * @param string $name * @param string $title [optional] * @param array $source [optional] * @param string $sortField [optional] - default is 'Sort' * @param string $value [optional] * @param Form $form [optional] */ public function __construct($name, $title = null, $source = array(), $sortField = 'Sort', $value = '', $form = null) { parent::__construct($name, $title, $source, $value, $form); $this->setSortField($sortField); }
/** * Creates a new dropdown field. * * @param string $name The field name * @param string $title The field title * @param array $source An map of the dropdown items * @param string|array $value You can pass an array of values or a single value like a drop down to be selected * @param int $size Optional size of the select element * @param form The parent form */ public function __construct($name, $title = '', $source = array(), $value = '', $form = null, $emptyString = null) { Requirements::css('sitetreeformfields/css/SiteTreeCheckboxSetField.css'); parent::__construct($name, $title, $source, $value, $form, $emptyString); }