public function getListingData(array $contenttype, $contentId, array $queryOptions)
    {
        // We have a content type, and possibly a content ID.
        $content = null;

        if ($contentId) {
            $content = $this->app['storage']->getContent($contenttype['slug'], ['id' => $contentId, 'hydrate' => false]);
            $queryOptions['contentid'] = $contentId;
        }

        // Getting a slice of data and the total count
        $logEntries = $this->changeRepository->getChangeLogByContentType($contenttype['slug'], $queryOptions);
        $itemCount = $this->changeRepository->countChangeLogByContentType($contenttype['slug'], $queryOptions);

        // The page title we're sending to the template depends on a few things:
        // If no contentid is given, we'll use the plural form of the content
        // type; otherwise, we'll derive it from the changelog or content item
        // itself.
        if ($contentId) {
            if ($content) {
                // content item is available: get the current title
                $title = $content->getTitle();
            } else {
                // content item does not exist (anymore).
                if (empty($logEntries)) {
                    // No item, no entries - phew. Content type name and ID
                    // will have to do.
                    $title = $contenttype['singular_name'] . ' #' . $contentId;
                } else {
                    // No item, but we can use the most recent title.
                    $title = $logEntries[0]['title'];
                }
            }
        } else {
            // We're displaying all changes for the entire content type,
            // so the plural name is most appropriate.
            $title = $contenttype['name'];
        }

        return ['content' => $content, 'title' => $title, 'entries' => $logEntries, 'count' => $itemCount];
    }
public function getListingData(array $contenttype, $contentId, array $queryOptions)
    {
        // We have a content type, and possibly a content ID.
        $content = null;

        if ($contentId) {
            $content = $this->app['storage']->getContent($contenttype['slug'], ['id' => $contentId, 'hydrate' => false]);
            $queryOptions['contentid'] = $contentId;
        }

        // Getting a slice of data and the total count
        $logEntries = $this->changeRepository->getChangeLogByContentType($contenttype['slug'], $queryOptions);
        $itemCount = $this->changeRepository->countChangeLogByContentType($contenttype['slug'], $queryOptions);

        // The page title we're sending to the template depends on a few things:
        // If no contentid is given, we'll use the plural form of the content
        // type; otherwise, we'll derive it from the changelog or content item
        // itself.
        if ($contentId) {
            if ($content) {
                // content item is available: get the current title
                $title = $content->getTitle();
            } else {
                // content item does not exist (anymore).
                if (empty($logEntries)) {
                    // No item, no entries - phew. Content type name and ID
                    // will have to do.
                    $title = $contenttype['singular_name'] . ' #' . $contentId;
                } else {
                    // No item, but we can use the most recent title.
                    $title = $logEntries[0]['title'];
                }
            }
        } else {
            // We're displaying all changes for the entire content type,
            // so the plural name is most appropriate.
            $title = $contenttype['name'];
        }

        return ['content' => $content, 'title' => $title, 'entries' => $logEntries, 'count' => $itemCount];
    }
public function getListingData ( array $ contenttype , $ contentId , array $ queryOptions ) { // We have a content type, and possibly a content ID. $ content = null ; if ( $ contentId ) { $ content = $ this -> app [ 'storage' ] -> getContent ( $ contenttype [ 'slug' ] , [ 'id' => $ contentId , 'hydrate' => false ] ) ; $ queryOptions [ 'contentid' ] = $ contentId ; } // Getting a slice of data and the total count $ logEntries = $ this -> changeRepository -> getChangeLogByContentType ( $ contenttype [ 'slug' ] , $ queryOptions ) ; $ itemCount = $ this -> changeRepository -> countChangeLogByContentType ( $ contenttype [ 'slug' ] , $ queryOptions ) ; // The page title we're sending to the template depends on a few things: // If no contentid is given, we'll use the plural form of the content // type; otherwise, we'll derive it from the changelog or content item // itself. if ( $ contentId ) { if ( $ content ) { // content item is available: get the current title $ title = $ content -> getTitle ( ) ; } else { // content item does not exist (anymore). if ( empty ( $ logEntries ) ) { // No item, no entries - phew. Content type name and ID // will have to do. $ title = $ contenttype [ 'singular_name' ] . ' #' . $ contentId ; } else { // No item, but we can use the most recent title. $ title = $ logEntries [ 0 ] [ 'title' ] ; } } } else { // We're displaying all changes for the entire content type, // so the plural name is most appropriate. $ title = $ contenttype [ 'name' ] ; } return [ 'content' => $ content , 'title' => $ title , 'entries' => $ logEntries , 'count' => $ itemCount ] ; }
Get the listing data such as title and count.

@param array $contenttype  The ContentType
@param int   $contentId    The content ID
@param array $queryOptions

@return array
Get the listing data such as title and count .