public function process($field, EntityInterface $data, array $options = [])
    {
        $this->setContext($data);

        $value = $this->fieldValue($data, $field);
        $options += ['formatter' => null];

        if ($options['formatter'] === 'element') {
            $context = $this->getContext();

            return $this->_View->element($options['element'], compact('context', 'field', 'value', 'options'));
        }

        if ($options['formatter'] === 'relation') {
            $relation = $this->relation($field);
            if ($relation) {
                return $relation['output'];
            }
        }

        if (is_callable($options['formatter'])) {
            return $options['formatter']($field, $value, $this->getContext(), $options, $this->getView());
        }

        $value = $this->introspect($field, $value, $options);

        return $value;
    }
public function process($field, EntityInterface $data, array $options = [])
    {
        $this->setContext($data);

        $value = $this->fieldValue($data, $field);
        $options += ['formatter' => null];

        if ($options['formatter'] === 'element') {
            $context = $this->getContext();

            return $this->_View->element($options['element'], compact('context', 'field', 'value', 'options'));
        }

        if ($options['formatter'] === 'relation') {
            $relation = $this->relation($field);
            if ($relation) {
                return $relation['output'];
            }
        }

        if (is_callable($options['formatter'])) {
            return $options['formatter']($field, $value, $this->getContext(), $options, $this->getView());
        }

        $value = $this->introspect($field, $value, $options);

        return $value;
    }
public function process ( $ field , EntityInterface $ data , array $ options = [ ] ) { $ this -> setContext ( $ data ) ; $ value = $ this -> fieldValue ( $ data , $ field ) ; $ options += [ 'formatter' => null ] ; if ( $ options [ 'formatter' ] === 'element' ) { $ context = $ this -> getContext ( ) ; return $ this -> _View -> element ( $ options [ 'element' ] , compact ( 'context' , 'field' , 'value' , 'options' ) ) ; } if ( $ options [ 'formatter' ] === 'relation' ) { $ relation = $ this -> relation ( $ field ) ; if ( $ relation ) { return $ relation [ 'output' ] ; } } if ( is_callable ( $ options [ 'formatter' ] ) ) { return $ options [ 'formatter' ] ( $ field , $ value , $ this -> getContext ( ) , $ options , $ this -> getView ( ) ) ; } $ value = $ this -> introspect ( $ field , $ value , $ options ) ; return $ value ; }
Process a single field into an output

@param string $field The field to process.
@param \Cake\Datasource\EntityInterface $data The entity data.
@param array $options Processing options.
@return string|null|array|bool|int
Process a single field into an output