Пример #1
0
 /**
  * @return array
  */
 public function createInputs()
 {
     $radios = array();
     if ($this->options) {
         $index = 1;
         foreach ($this->options as $value => $label) {
             $id = $this->id . $index;
             $index++;
             $radio = new FormInput($this->form, $this->name, array('type' => 'radio', 'value' => $value, 'multiple' => true, 'id' => $id));
             $label = new Label(array('content' => $label, 'for' => $id));
             $this->inputs[] = array($radio, $label);
             if (isset($this->attributes['value']) && self::compareValues($this->attributes['value'], $value)) {
                 $radio->setChecked(true);
             }
             $radios[] = array('label' => $label, 'input' => $radio);
         }
     }
     return $radios;
 }
Пример #2
0
 /**
  * @return array
  */
 public function createInputs()
 {
     $triggers = array();
     if ($this->options) {
         $index = 1;
         $defaultAttributes = array_intersect_key($this->attributes, array_flip($this->passAttributes));
         foreach ($this->options as $value => $label) {
             $id = $this->id . $index;
             $index++;
             $localAttributes = array_merge($defaultAttributes, array('type' => $this->multiple ? 'checkbox' : 'radio', 'value' => $value, 'label' => $label, 'class' => 'trigger-button', 'multiple' => $this->multiple, 'id' => $id));
             $trigger = new FormInput($this->form, $this->name, $localAttributes);
             $label = new Label(array('content' => $label, 'for' => $id));
             $this->triggers[] = array($trigger, $label);
             if (isset($this->attributes['value']) && self::compareValues($this->attributes['value'], $value)) {
                 $trigger->setChecked(true);
             }
             $triggers[] = array('label' => $label, 'input' => $trigger);
         }
     }
     return $triggers;
 }