protected function buildFormOptions(array $payload=null)
    {
        $formOptions = null;
        switch ($this->configuration->get('collection_type')) {
            case self::COLLECTION_TYPE_ONE:
            case self::COLLECTION_TYPE_MANY:
                $formOptions = array();
                if (!is_null($payload)
                    && isset($payload[$this->getName()])
                ) {
                    if (isset($payload[$this->getName()][$this->getFormOptionKey()])) {
                        if (is_array($payload[$this->getName()][$this->getFormOptionKey()])) {
                            $formOptions = $payload[$this->getName()][$this->getFormOptionKey()];
                        } else {
                            $formOptions = array($payload[$this->getName()][$this->getFormOptionKey()]);
                        }
                        $this->logger->debug('form with option "{value}"', array('name' => $this->getName(), 'value' => $payload[$this->getName()][$this->getFormOptionKey()]));
                    } else {
                        $this->logger->debug('missing form option', array('name' => $this->getName(), 'payload' => $payload));
                        // TODO set error
                    }
                }
                break;
        }

        return $formOptions;
    }
protected function buildFormOptions(array $payload=null)
    {
        $formOptions = null;
        switch ($this->configuration->get('collection_type')) {
            case self::COLLECTION_TYPE_ONE:
            case self::COLLECTION_TYPE_MANY:
                $formOptions = array();
                if (!is_null($payload)
                    && isset($payload[$this->getName()])
                ) {
                    if (isset($payload[$this->getName()][$this->getFormOptionKey()])) {
                        if (is_array($payload[$this->getName()][$this->getFormOptionKey()])) {
                            $formOptions = $payload[$this->getName()][$this->getFormOptionKey()];
                        } else {
                            $formOptions = array($payload[$this->getName()][$this->getFormOptionKey()]);
                        }
                        $this->logger->debug('form with option "{value}"', array('name' => $this->getName(), 'value' => $payload[$this->getName()][$this->getFormOptionKey()]));
                    } else {
                        $this->logger->debug('missing form option', array('name' => $this->getName(), 'payload' => $payload));
                        // TODO set error
                    }
                }
                break;
        }

        return $formOptions;
    }
protected function buildFormOptions ( array $ payload = null ) { $ formOptions = null ; switch ( $ this -> configuration -> get ( 'collection_type' ) ) { case self :: COLLECTION_TYPE_ONE : case self :: COLLECTION_TYPE_MANY : $ formOptions = array ( ) ; if ( ! is_null ( $ payload ) && isset ( $ payload [ $ this -> getName ( ) ] ) ) { if ( isset ( $ payload [ $ this -> getName ( ) ] [ $ this -> getFormOptionKey ( ) ] ) ) { if ( is_array ( $ payload [ $ this -> getName ( ) ] [ $ this -> getFormOptionKey ( ) ] ) ) { $ formOptions = $ payload [ $ this -> getName ( ) ] [ $ this -> getFormOptionKey ( ) ] ; } else { $ formOptions = array ( $ payload [ $ this -> getName ( ) ] [ $ this -> getFormOptionKey ( ) ] ) ; } $ this -> logger -> debug ( 'form with option "{value}"' , array ( 'name' => $ this -> getName ( ) , 'value' => $ payload [ $ this -> getName ( ) ] [ $ this -> getFormOptionKey ( ) ] ) ) ; } else { $ this -> logger -> debug ( 'missing form option' , array ( 'name' => $ this -> getName ( ) , 'payload' => $ payload ) ) ; // TODO set error } } break ; } return $ formOptions ; }
return form options

@param     array     $payload      submitted form data
@return    array
return form options