public function addOptionsAsArray(array $options, $useArrayKeyAsValue = true)
    {
        foreach ($options as $value => $label) {
            $option = new Option();
            $option->setLabel($label);
            $option->setValue($useArrayKeyAsValue ? $value : $label);

            $this->options[] = $option;
        }

        // this will auto select the options based on this fields value
        $this->selectOptionsFromValue();

        return $this;
    }
public function addOptionsAsArray(array $options, $useArrayKeyAsValue = true)
    {
        foreach ($options as $value => $label) {
            $option = new Option();
            $option->setLabel($label);
            $option->setValue($useArrayKeyAsValue ? $value : $label);

            $this->options[] = $option;
        }

        // this will auto select the options based on this fields value
        $this->selectOptionsFromValue();

        return $this;
    }
public function addOptionsAsArray ( array $ options , $ useArrayKeyAsValue = true ) { foreach ( $ options as $ value => $ label ) { $ option = new Option ( ) ; $ option -> setLabel ( $ label ) ; $ option -> setValue ( $ useArrayKeyAsValue ? $ value : $ label ) ; $ this -> options [ ] = $ option ; } // this will auto select the options based on this fields value $ this -> selectOptionsFromValue ( ) ; return $ this ; }
Add options with an assoc array

@param array $options
@param boolean $useArrayKeyAsValue
@return SelectField
Add options with an assoc array