public function __construct($data = array()) { parent::__construct($data); if (!is_array($this->options)) { $this->options = array(); } $i = 0; foreach ($this->options as $value => &$option) { $i++; if (!$option instanceof CheckBoxCustom) { if (is_string($option)) { $option = new CheckBoxCustom(array('value' => $value, 'label' => (string) $option)); } else { if (is_array($option)) { $option = new CheckBoxCustom($option); } else { continue; } } } if (isset($this->value)) { $option->checked = $option->value == $this->value; } $option->name = $this->name; if (!isset($option->id)) { $option->id = $this->id . "-{$i}"; } } }
public function __construct($data = array()) { parent::__construct($data); if (!is_array($this->options)) { $this->options = array(); } foreach ($this->options as $value => &$option) { if (is_string($option)) { $option = new Radio(array('value' => $value, 'label' => (string) $option, 'name' => $this->name)); } else { if (is_array($option)) { $option = new Radio($option + array('name' => $this->name, 'level' => $this->level + 1)); } else { continue; } } if (isset($this->value)) { $option->checked = $option->value == $this->value; } $option->id = $this->id . '-' . $option->value; } }
public function __construct($name) { parent::__construct($name); $this->level = 1; }