コード例 #1
0
ファイル: LanguageDetectorTest.php プロジェクト: alpas29/cms
 public function test_it_can_give_me_primary_language_id()
 {
     $Config = m::mock('Illuminate\\Config\\Repository');
     $Config->shouldReceive('get')->times(1)->andReturn(45);
     $LanguageDetector = new LanguageDetector(new LocaleDetector($this->Framework), new \DvsLanguage(), $Config);
     assertEquals(45, $LanguageDetector->primaryLanguageId());
 }
コード例 #2
0
ファイル: MenusRepository.php プロジェクト: devisephp/cms
 /**
  * @param \DvsMenu $Menu
  * @param \DvsMenuItem $MenuItem
  * @param LanguageDetector $LanguageDetector
  * @param Framework $Framework
  */
 public function __construct(\DvsMenu $Menu, \DvsMenuItem $MenuItem, LanguageDetector $LanguageDetector, UserHelper $UserHelper, Framework $Framework)
 {
     $this->Menu = $Menu;
     $this->MenuItem = $MenuItem;
     $this->LanguageDetector = $LanguageDetector;
     $this->currentLanguage = $LanguageDetector->current();
     $this->Input = $Framework->Input;
     $this->UserHelper = $UserHelper;
 }
コード例 #3
0
ファイル: PagesRepository.php プロジェクト: alpas29/cms
 /**
  * Wrap all fields around the page
  *
  * @param  Page $page
  * @param $pageVersion
  * @return Page
  */
 protected function wrapFieldsAroundPage($page, $pageVersion)
 {
     $language = $this->LanguageDetector->current();
     $globalFields = $this->GlobalField->where('language_id', $language->id)->get();
     $page = $this->wrapTheseFieldsAroundThisPage($globalFields, $page);
     $page = $this->wrapTheseFieldsAroundThisPage($pageVersion->fields, $page);
     $page = $this->wrapTheseCollectionsAroundThisPage($this->CollectionsRepository->findCollectionsForPageVersion($pageVersion), $page);
     return $page;
 }
コード例 #4
0
ファイル: PagesRepository.php プロジェクト: devisephp/cms
 /**
  * Wrap all fields around the page
  *
  * @param  Page $page
  * @param $pageVersion
  * @return Page
  */
 protected function wrapFieldsAroundPage($page, $pageVersion)
 {
     $language = $this->LanguageDetector->current();
     // loading primary language if language cannot be detected
     $languageId = $language ? $language->id : $this->Config->get('devise.primary_language_id.primary_language_id');
     $globalFields = $this->GlobalField->where('language_id', $languageId)->get();
     $page = $this->wrapTheseFieldsAroundThisPage($globalFields, $page);
     $page = $this->wrapTheseFieldsAroundThisPage($pageVersion->fields, $page);
     $page = $this->wrapTheseCollectionsAroundThisPage($this->CollectionsRepository->findCollectionsForPageVersion($pageVersion), $page);
     return $page;
 }