當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Section::getDefaultSection方法代碼示例

本文整理匯總了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);
             }
         }
     }
 }
開發者ID:ceko,項目名稱:concrete5-1,代碼行數:24,代碼來源:StackList.php

示例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;
 }
開發者ID:Remo,項目名稱:concrete5-1,代碼行數:42,代碼來源:Stack.php

示例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;
 }
開發者ID:ceko,項目名稱:concrete5-1,代碼行數:14,代碼來源:Stack.php


注:本文中的Concrete\Core\Multilingual\Page\Section\Section::getDefaultSection方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。