Skip to content

Instantly share code, notes, and snippets.

@hissy
Last active August 29, 2015 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hissy/a950a996609701df6dc4 to your computer and use it in GitHub Desktop.
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.
<?php
// application/config/app.php
return array(
'aliases' => array(
'GlobalArea' => '\Application\Src\Area\GlobalArea'
)
);
<?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