本文整理汇总了PHP中Concrete\Core\Page\Page::getSiteTreeObject方法的典型用法代码示例。如果您正苦于以下问题:PHP Page::getSiteTreeObject方法的具体用法?PHP Page::getSiteTreeObject怎么用?PHP Page::getSiteTreeObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Concrete\Core\Page\Page
的用法示例。
在下文中一共展示了Page::getSiteTreeObject方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getBySectionOfSite
/**
* @param Page $page
*
* @return Section
*/
public static function getBySectionOfSite($page)
{
$identifier = sprintf('/multilingual/section/%s', $page->getCollectionID());
$cache = \Core::make('cache/request');
$item = $cache->getItem($identifier);
if (!$item->isMiss()) {
$returnID = $item->get();
} else {
$item->lock();
$tree = $page->getSiteTreeObject();
$returnID = false;
if ($tree instanceof SiteTree) {
$returnID = $tree->getSiteHomePageID();
}
$cache->save($item->set($returnID));
}
if ($returnID) {
return static::getByID($returnID);
}
}
示例2: addStackToCategory
private static function addStackToCategory(\Concrete\Core\Page\Page $parent, $name, $type = 0)
{
$data = array();
$data['name'] = $name;
if (!$name) {
$data['name'] = t('No Name');
}
$pagetype = PageType::getByHandle(STACKS_PAGE_TYPE);
$page = $parent->add($pagetype, $data);
// we have to do this because we need the area to exist before we try and add something to it.
Area::getOrCreate($page, STACKS_AREA_NAME);
// finally we add the row to the stacks table
$db = Database::connection();
$stackCID = $page->getCollectionID();
$siteTreeID = $parent->getSiteTreeObject()->getSiteTreeID();
$v = array($name, $stackCID, $type, $siteTreeID);
$db->Execute('insert into Stacks (stName, cID, stType, siteTreeID) values (?, ?, ?, ?)', $v);
$stack = static::getByID($stackCID);
return $stack;
}