code/libraries/joomlatools/library/view/json.php
protected function _getEntity(KModelEntityInterface $entity)
    {
        $method = '_get'.ucfirst($entity->getIdentifier()->name);

        if ($method !== '_getEntity' && method_exists($this, $method)) {
            $data = $this->$method($entity);
        } else {
            $data = $entity->toArray();
        }

        if (!empty($this->_fields)) {
            $data = array_intersect_key($data, array_merge(array('links' => 'links'), array_flip($this->_fields)));
        }

        if (!isset($data['links'])) {
            $data['links'] = array();
        }

        if (!isset($data['links']['self']))
        {
            $data['links']['self'] = array(
                'href' => (string) $this->_getEntityRoute($entity),
                'type' => 'application/json; version=1.0',
            );
        }

        return $data;
    }
protected function _getEntity(KModelEntityInterface $entity)
    {
        $method = '_get'.ucfirst($entity->getIdentifier()->name);

        if ($method !== '_getEntity' && method_exists($this, $method)) {
            $data = $this->$method($entity);
        } else {
            $data = $entity->toArray();
        }

        if (!empty($this->_fields)) {
            $data = array_intersect_key($data, array_merge(array('links' => 'links'), array_flip($this->_fields)));
        }

        if (!isset($data['links'])) {
            $data['links'] = array();
        }

        if (!isset($data['links']['self']))
        {
            $data['links']['self'] = array(
                'href' => (string) $this->_getEntityRoute($entity),
                'type' => 'application/json; version=1.0',
            );
        }

        return $data;
    }
protected function _getEntity ( KModelEntityInterface $ entity ) { $ method = '_get' . ucfirst ( $ entity -> getIdentifier ( ) -> name ) ; if ( $ method !== '_getEntity' && method_exists ( $ this , $ method ) ) { $ data = $ this -> $ method ( $ entity ) ; } else { $ data = $ entity -> toArray ( ) ; } if ( ! empty ( $ this -> _fields ) ) { $ data = array_intersect_key ( $ data , array_merge ( array ( 'links' => 'links' ) , array_flip ( $ this -> _fields ) ) ) ; } if ( ! isset ( $ data [ 'links' ] ) ) { $ data [ 'links' ] = array ( ) ; } if ( ! isset ( $ data [ 'links' ] [ 'self' ] ) ) { $ data [ 'links' ] [ 'self' ] = array ( 'href' => ( string ) $ this -> _getEntityRoute ( $ entity ) , 'type' => 'application/json; version=1.0' , ) ; } return $ data ; }
Get the item data

@param KModelEntityInterface  $entity   Document row
@return array The array with data to be encoded to json
Get the item data