view/activities/json.php
protected function _getEntity(KModelEntityInterface $entity)
    {
        if ($this->_layout == 'stream')
        {
            $activity = $entity;
            $renderer = $this->getRenderer();

            $item = array(
                'id'        => $activity->getActivityId(),
                'title'     => $renderer->render($activity, array('escaped_urls' => false, 'fqr' => true)),
                'story'     => $renderer->render($activity, array('html' => false)),
                'published' => $activity->getActivityPublished()->format('c'),
                'verb'      => $activity->getActivityVerb(),
                'format'    => $activity->getActivityFormat(),
                'locale'  => $activity->getLocale()
            );

            if ($icon = $activity->getActivityIcon()) {
                $item['icon'] = $this->_getMediaLinkData($icon);
            }

            foreach ($activity->objects as $name => $object)
            {
                $clone = clone $object;

                if ($object->isTranslatable())
                {
                    $translator = $activity->getTranslator();
                    $clone->setDisplayName($translator->translateActivityToken($clone, $activity));
                }

                $item[$name] = $this->_getObjectData($clone);
            }
        }
        else
        {
            $item = $entity->toArray();
            if (!empty($this->_fields)) {
                $item = array_intersect_key($item, array_flip($this->_fields));
            }
        }

        return $item;
    }
protected function _getEntity(KModelEntityInterface $entity)
    {
        if ($this->_layout == 'stream')
        {
            $activity = $entity;
            $renderer = $this->getRenderer();

            $item = array(
                'id'        => $activity->getActivityId(),
                'title'     => $renderer->render($activity, array('escaped_urls' => false, 'fqr' => true)),
                'story'     => $renderer->render($activity, array('html' => false)),
                'published' => $activity->getActivityPublished()->format('c'),
                'verb'      => $activity->getActivityVerb(),
                'format'    => $activity->getActivityFormat(),
                'locale'  => $activity->getLocale()
            );

            if ($icon = $activity->getActivityIcon()) {
                $item['icon'] = $this->_getMediaLinkData($icon);
            }

            foreach ($activity->objects as $name => $object)
            {
                $clone = clone $object;

                if ($object->isTranslatable())
                {
                    $translator = $activity->getTranslator();
                    $clone->setDisplayName($translator->translateActivityToken($clone, $activity));
                }

                $item[$name] = $this->_getObjectData($clone);
            }
        }
        else
        {
            $item = $entity->toArray();
            if (!empty($this->_fields)) {
                $item = array_intersect_key($item, array_flip($this->_fields));
            }
        }

        return $item;
    }
protected function _getEntity ( KModelEntityInterface $ entity ) { if ( $ this -> _layout == 'stream' ) { $ activity = $ entity ; $ renderer = $ this -> getRenderer ( ) ; $ item = array ( 'id' => $ activity -> getActivityId ( ) , 'title' => $ renderer -> render ( $ activity , array ( 'escaped_urls' => false , 'fqr' => true ) ) , 'story' => $ renderer -> render ( $ activity , array ( 'html' => false ) ) , 'published' => $ activity -> getActivityPublished ( ) -> format ( 'c' ) , 'verb' => $ activity -> getActivityVerb ( ) , 'format' => $ activity -> getActivityFormat ( ) , 'locale' => $ activity -> getLocale ( ) ) ; if ( $ icon = $ activity -> getActivityIcon ( ) ) { $ item [ 'icon' ] = $ this -> _getMediaLinkData ( $ icon ) ; } foreach ( $ activity -> objects as $ name => $ object ) { $ clone = clone $ object ; if ( $ object -> isTranslatable ( ) ) { $ translator = $ activity -> getTranslator ( ) ; $ clone -> setDisplayName ( $ translator -> translateActivityToken ( $ clone , $ activity ) ) ; } $ item [ $ name ] = $ this -> _getObjectData ( $ clone ) ; } } else { $ item = $ entity -> toArray ( ) ; if ( ! empty ( $ this -> _fields ) ) { $ item = array_intersect_key ( $ item , array_flip ( $ this -> _fields ) ) ; } } return $ item ; }
Get the entity data

@link http://activitystrea.ms/specs/json/1.0/#json See JSON serialization.

@param KModelEntityInterface $entity The model entity.
@return array The array with data to be encoded to JSON.
Get the entity data