Example #1
0
 /**
  * Set options for an element. Accepted options are:
  * - label: label to associate with the element
  * - label_attributes: attributes to use when the label is rendered
  * - value_options: list of values and labels for the select options
  * - empty_option: should an empty option be prepended to the options ?
  *
  * @param  array|\Traversable $options
  * @return RadioGroup|ElementInterface
  * @throws InvalidArgumentException
  */
 public function setOptions($options)
 {
     parent::setOptions($options);
     if (isset($this->options['value_options'])) {
         $this->setValueOptions($this->options['value_options']);
     }
     // Alias for 'value_options'
     if (isset($this->options['options'])) {
         $this->setValueOptions($this->options['options']);
     }
     if (isset($this->options['empty_option'])) {
         $this->setEmptyOption($this->options['empty_option']);
     }
     return $this;
 }