getAggregate() public method

Get all data for an entire catalog, cached
public getAggregate ( ) : array
return array
Example #1
0
/**
 * Get book data
 * Sort by featured DESC, title ASC
 *
 * @param PB_Catalog $catalog
 *
 * @return array
 */
function _books(PB_Catalog $catalog)
{
    $books = $catalog->getAggregate();
    foreach ($books as $key => $val) {
        // Deleted
        if ($val['deleted']) {
            unset($books[$key]);
            continue;
        }
        // Calculate cover height
        $books[$key]['cover_height'] = _cover_height($val['cover_url']['pb_cover_medium']);
    }
    return \PressBooks\Utility\multi_sort($books, 'featured:desc', 'title:asc');
}
 /**
  * @return array
  */
 protected function getItemsData()
 {
     // TODO: Improve search filter for big data
     $catalog_obj = new Catalog();
     $data = $catalog_obj->getAggregate();
     foreach ($data as $key => $val) {
         $data[$key]['status'] = 1 == $val['deleted'] ? 0 : 1;
         $data[$key]['privacy'] = 1 == $val['private'] ? __('Private', 'pressbooks') : __('Public', 'pressbooks');
         $data[$key]['cover'] = $val['cover_url']['pb_cover_small'];
     }
     return $this->searchFilter($data);
 }