Last active
August 29, 2015 14:11
-
-
Save hissy/a950a996609701df6dc4 to your computer and use it in GitHub Desktop.
#concrete5 #5.7 How to generate Global Areas for each language section, for multilingual site.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// application/config/app.php | |
return array( | |
'aliases' => array( | |
'GlobalArea' => '\Application\Src\Area\GlobalArea' | |
) | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// application/src/Area/GlobalArea.php | |
namespace Application\Src\Area; | |
use Concrete\Core\Area\GlobalArea as CoreGlobalArea; | |
use Concrete\Core\Multilingual\Page\Section\Section as MultilingualSection; | |
use Localization; | |
use Punic\Language; | |
use Punic\Data; | |
class GlobalArea extends CoreGlobalArea | |
{ | |
public function __construct($arHandle) | |
{ | |
$ms = MultilingualSection::getCurrentSection(); | |
if (is_object($ms)) { | |
$locale = $ms->getLocale(); | |
} else { | |
$locale = Localization::activeLocale(); | |
} | |
$fallbackLocale = Data::getFallbackLocale(); | |
if ($locale != $fallbackLocale) { | |
$locName = Language::getName($locale, $fallbackLocale); | |
$arHandle = $arHandle . ' ' . $locName; | |
} | |
$this->arHandle = $arHandle; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment