/** * @param $value * @param null $label * * @return $this */ public function addOption($value, $label = null) { if ($value instanceof Option) { $this->getContent()->append($value); } else { $this->getContent()->append(Option::option($value, $label)); } return $this; }
public static function option($value, $label = null) { if (is_null($label)) { $label = $value; $value = null; } $option = Option::factory('option', $label); if ($value) { $option->addAttribute('value', $value); } return self::decorate($option); }