本文整理汇总了PHP中Concrete\Core\Multilingual\Page\Section\Section::getDefaultSection方法的典型用法代码示例。如果您正苦于以下问题:PHP Section::getDefaultSection方法的具体用法?PHP Section::getDefaultSection怎么用?PHP Section::getDefaultSection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Concrete\Core\Multilingual\Page\Section\Section
的用法示例。
在下文中一共展示了Section::getDefaultSection方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rescanMultilingualStacks
public static function rescanMultilingualStacks()
{
$sl = new static();
$stacks = $sl->get();
foreach ($stacks as $stack) {
$section = $stack->getMultilingualSection();
if (!$section) {
$section = false;
$parent = \Page::getByID($stack->getCollectionParentID());
if ($parent->getCollectionPath() == STACKS_PAGE_PATH) {
// this is the default
$section = Section::getDefaultSection();
} else {
if ($parent->getPageTypeHandle() == STACK_CATEGORY_PAGE_TYPE) {
$locale = $parent->getCollectionHandle();
$section = Section::getByLocale($locale);
}
}
if ($section) {
$stack->updateMultilingualSection($section);
}
}
}
}
示例2: getByName
/**
* @param string $stackName
* @param string $cvID
* @param integer $multilingualContentSource
* @return Page
*/
public static function getByName($stackName, $cvID = 'RECENT', $multilingualContentSource = self::MULTILINGUAL_CONTENT_SOURCE_CURRENT)
{
$c = Page::getCurrentPage();
if (is_object($c) && !$c->isError()) {
$identifier = sprintf('/stack/name/%s/%s/%s/%s', $stackName, $c->getCollectionID(), $cvID, $multilingualContentSource);
$cache = Core::make('cache/request');
$item = $cache->getItem($identifier);
if (!$item->isMiss()) {
$cID = $item->get();
} else {
$item->lock();
$db = Database::connection();
$ms = false;
$detector = Core::make('multilingual/detector');
if ($detector->isEnabled()) {
if ($multilingualContentSource == self::MULTILINGUAL_CONTENT_SOURCE_DEFAULT) {
$ms = Section::getDefaultSection();
} else {
$ms = Section::getBySectionOfSite($c);
if (!is_object($ms)) {
$ms = $detector->getPreferredSection();
}
}
}
if (is_object($ms)) {
$cID = $db->GetOne('select cID from Stacks where stName = ? and stMultilingualSection = ?', array($stackName, $ms->getCollectionID()));
} else {
$cID = $db->GetOne('select cID from Stacks where stName = ?', array($stackName));
}
$item->set($cID);
}
} else {
$cID = Database::connection()->GetOne('select cID from Stacks where stName = ?', array($stackName));
}
return $cID ? static::getByID($cID, $cvID) : false;
}
示例3: getMultilingualSectionFromType
protected function getMultilingualSectionFromType($type)
{
$detector = Core::make('multilingual/detector');
if ($type == self::MULTILINGUAL_CONTENT_SOURCE_DEFAULT) {
$ms = Section::getDefaultSection();
} else {
$c = \Page::getCurrentPage();
$ms = Section::getBySectionOfSite($c);
if (!is_object($ms)) {
$ms = $detector->getPreferredSection();
}
}
return $ms;
}