public function getSourceValue($fieldname, $options = [])
    {
        $valueMap = [
            'data' => 'getData',
            'query' => 'getQuery'
        ];
        foreach ($this->getValueSources() as $valuesSource) {
            if ($valuesSource === 'context') {
                $val = $this->_getContext()->val($fieldname, $options);
                if ($val !== null) {
                    return $val;
                }
            }
            if (isset($valueMap[$valuesSource])) {
                $method = $valueMap[$valuesSource];
                $value = $this->_View->getRequest()->{$method}($fieldname);
                if ($value !== null) {
                    return $value;
                }
            }
        }

        return null;
    }
public function getSourceValue($fieldname, $options = [])
    {
        $valueMap = [
            'data' => 'getData',
            'query' => 'getQuery'
        ];
        foreach ($this->getValueSources() as $valuesSource) {
            if ($valuesSource === 'context') {
                $val = $this->_getContext()->val($fieldname, $options);
                if ($val !== null) {
                    return $val;
                }
            }
            if (isset($valueMap[$valuesSource])) {
                $method = $valueMap[$valuesSource];
                $value = $this->_View->getRequest()->{$method}($fieldname);
                if ($value !== null) {
                    return $value;
                }
            }
        }

        return null;
    }
public function getSourceValue ( $ fieldname , $ options = [ ] ) { $ valueMap = [ 'data' => 'getData' , 'query' => 'getQuery' ] ; foreach ( $ this -> getValueSources ( ) as $ valuesSource ) { if ( $ valuesSource === 'context' ) { $ val = $ this -> _getContext ( ) -> val ( $ fieldname , $ options ) ; if ( $ val !== null ) { return $ val ; } } if ( isset ( $ valueMap [ $ valuesSource ] ) ) { $ method = $ valueMap [ $ valuesSource ] ; $ value = $ this -> _View -> getRequest ( ) -> { $ method } ( $ fieldname ) ; if ( $ value !== null ) { return $ value ; } } } return null ; }
Gets a single field value from the sources available.

@param string $fieldname The fieldname to fetch the value for.
@param array|null $options The options containing default values.
@return string|null Field value derived from sources or defaults.
Gets a single field value from the sources available .