示例#1
0
 /**
  * @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;
 }
示例#2
0
 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);
 }