当前位置: 首页>>代码示例>>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;未经允许,请勿转载。