Source of file LabeledCheckboxField.php
Size: 1,860 Bytes - Last Modified: 2021-12-24T06:49:04+00:00
/var/www/docs.ssmods.com/process/src/code/Form/Fields/LabeledCheckboxField.php
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 | <?php class LabeledCheckboxField extends CompositeField { /** * * @var LabelField */ protected $labelField; /** * * @var CheckboxField */ protected $checkboxField; public function getLabelField() { return $this->labelField; } public function getCheckboxField() { return $this->checkboxField; } public function setLabelField(LabelField $labelField) { $this->labelField = $labelField; return $this; } public function setCheckboxField(CheckboxField $checkboxField) { $this->checkboxField = $checkboxField; return $this; } public function __construct($name, $title = null, $value = null) { $this->labelField = LabelField::create($name . "Label", self::name_to_label($name))->addExtraClass("left"); $this->checkboxField = CheckboxField::create($name, "", $value); $this->labelField->setTemplate("LabeledCheckboxLabelField"); $this->addExtraClass("field"); parent::__construct(array( $this->labelField, $this->checkboxField )); } public function FieldHolder($properties = array()) { $this->labelField->setAttribute("for", $this->checkboxField->ID()); return parent::FieldHolder($properties); } public function forTemplate() { $this->labelField->setAttribute("for", $this->checkboxField->ID()); return parent::forTemplate(); } public function setForm($form) { $result = parent::setForm($form); $this->labelField->setAttribute("for", $this->checkboxField->ID()); return $result; } public function setCheckboxDescription($description) { $this->checkboxField->setDescription($description); return $this; } } |