original_string: 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;
      }
code: 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;
      }
code_tokens: 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 ; }
docstring: 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.
docstring_tokens: Gets a single field value from the sources available .