Frontend\Modules\Pages\Engine\Model::getSubpages PHP Метод

getSubpages() публичный статический Метод

Fetch a list of subpages of a page.
public static getSubpages ( integer $id ) : array
$id integer The id of the item to grab the subpages for.
Результат array
    public static function getSubpages($id)
    {
        // fetch items
        $items = (array) FrontendModel::getContainer()->get('database')->getRecords('SELECT i.id, i.title, m.description, i.parent_id
             FROM pages AS i
             INNER JOIN meta AS m ON m.id = i.meta_id
             WHERE i.parent_id = ? AND i.status = ? AND i.hidden = ?
             AND i.language = ? AND i.publish_on <= ?
             ORDER BY i.sequence ASC', array((int) $id, 'active', 'N', LANGUAGE, FrontendModel::getUTCDate('Y-m-d H:i') . ':00'));
        // has items
        if (!empty($items)) {
            // reset url
            foreach ($items as &$row) {
                $row['full_url'] = FrontendNavigation::getURL($row['id'], LANGUAGE);
            }
        }
        // return
        return $items;
    }

Usage Example

Пример #1
0
 /**
  * Load the data
  */
 private function loadData()
 {
     // get the current page id
     $pageId = $this->getContainer()->get('page')->getId();
     // fetch the items
     $this->items = FrontendPagesModel::getSubpages($pageId);
 }