public function showCollections()
    {
        // Get dependencies
        $collectionMapper = ($this->container->dataMapper)('CollectionMapper');
        $pageMapper = ($this->container->dataMapper)('PageMapper');

        // Fetch collection pages, and chuck pages into sub-array by collection ID with meta info
        $collectionPages = $pageMapper->findCollectionPages();
        foreach ($collectionPages as $col) {
            if (!isset($data['collectionPages'][$col->collection_id])) {
                $data['collectionPages'][$col->collection_id]['collection_id'] = $col->collection_id;
                $data['collectionPages'][$col->collection_id]['collection_title'] = $col->collection_title;
                $data['collectionPages'][$col->collection_id]['collection_slug'] = $col->collection_slug;
            }

            $data['collectionPages'][$col->collection_id]['pages'][] = $col;
        }

        // Get available templates and collection groups
        $data['templates'] = $this->getPageTemplates('collection');
        $data['collections'] = $collectionMapper->find();

        // Enrich collections array with matching description from templates array
        $templateArray = array_column($data['templates'], 'filename');
        array_walk($data['collections'], function (&$collect) use ($data, $templateArray) {
            // Find matching collection template key for reference in $templateArray
            $key = array_search($collect->definition, $templateArray);
            $collect->templateName = $data['templates'][$key]['name'];
            $collect->templateDescription = $data['templates'][$key]['description'];
        });

        return $this->render('collections.html', $data);
    }
public function showCollections()
    {
        // Get dependencies
        $collectionMapper = ($this->container->dataMapper)('CollectionMapper');
        $pageMapper = ($this->container->dataMapper)('PageMapper');

        // Fetch collection pages, and chuck pages into sub-array by collection ID with meta info
        $collectionPages = $pageMapper->findCollectionPages();
        foreach ($collectionPages as $col) {
            if (!isset($data['collectionPages'][$col->collection_id])) {
                $data['collectionPages'][$col->collection_id]['collection_id'] = $col->collection_id;
                $data['collectionPages'][$col->collection_id]['collection_title'] = $col->collection_title;
                $data['collectionPages'][$col->collection_id]['collection_slug'] = $col->collection_slug;
            }

            $data['collectionPages'][$col->collection_id]['pages'][] = $col;
        }

        // Get available templates and collection groups
        $data['templates'] = $this->getPageTemplates('collection');
        $data['collections'] = $collectionMapper->find();

        // Enrich collections array with matching description from templates array
        $templateArray = array_column($data['templates'], 'filename');
        array_walk($data['collections'], function (&$collect) use ($data, $templateArray) {
            // Find matching collection template key for reference in $templateArray
            $key = array_search($collect->definition, $templateArray);
            $collect->templateName = $data['templates'][$key]['name'];
            $collect->templateDescription = $data['templates'][$key]['description'];
        });

        return $this->render('collections.html', $data);
    }
public function showCollections ( ) { // Get dependencies $ collectionMapper = ( $ this -> container -> dataMapper ) ( 'CollectionMapper' ) ; $ pageMapper = ( $ this -> container -> dataMapper ) ( 'PageMapper' ) ; // Fetch collection pages, and chuck pages into sub-array by collection ID with meta info $ collectionPages = $ pageMapper -> findCollectionPages ( ) ; foreach ( $ collectionPages as $ col ) { if ( ! isset ( $ data [ 'collectionPages' ] [ $ col -> collection_id ] ) ) { $ data [ 'collectionPages' ] [ $ col -> collection_id ] [ 'collection_id' ] = $ col -> collection_id ; $ data [ 'collectionPages' ] [ $ col -> collection_id ] [ 'collection_title' ] = $ col -> collection_title ; $ data [ 'collectionPages' ] [ $ col -> collection_id ] [ 'collection_slug' ] = $ col -> collection_slug ; } $ data [ 'collectionPages' ] [ $ col -> collection_id ] [ 'pages' ] [ ] = $ col ; } // Get available templates and collection groups $ data [ 'templates' ] = $ this -> getPageTemplates ( 'collection' ) ; $ data [ 'collections' ] = $ collectionMapper -> find ( ) ; // Enrich collections array with matching description from templates array $ templateArray = array_column ( $ data [ 'templates' ] , 'filename' ) ; array_walk ( $ data [ 'collections' ] , function ( & $ collect ) use ( $ data , $ templateArray ) { // Find matching collection template key for reference in $templateArray $ key = array_search ( $ collect -> definition , $ templateArray ) ; $ collect -> templateName = $ data [ 'templates' ] [ $ key ] [ 'name' ] ; $ collect -> templateDescription = $ data [ 'templates' ] [ $ key ] [ 'description' ] ; } ) ; return $ this -> render ( 'collections.html' , $ data ) ; }
Show Collections and Collection Pages

Show all collection groups, collection templates, and collection pages
Show Collections and Collection Pages