Skip to content

Instantly share code, notes, and snippets.

@Fi1osof
Created December 22, 2014 22:42
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 Fi1osof/5a1a114ef7bd99624f76 to your computer and use it in GitHub Desktop.
Save Fi1osof/5a1a114ef7bd99624f76 to your computer and use it in GitHub Desktop.
<?php
require_once MODX_CORE_PATH.'components/modxsite/processors/site/web/resources/getdata.class.php';
class modSocietyWebResourcesGetdataProcessor extends modSiteWebResourcesGetdataProcessor{
public function initialize(){
$this->setDefaultProperties(array(
"cultureKey" => $this->modx->getOption('cultureKey'),
));
return parent::initialize();
}
protected function setSelection(xPDOQuery $c){
$c = parent::setSelection($c);
$lang = $this->getProperty('cultureKey');
if($lang != 'ru'){
$c->leftJoin('XlexiconDictionary', "Dictionary", "Dictionary.res = {$this->classKey}.id AND Dictionary.language = '{$lang}'");
$c->select(array(
"if(Dictionary.pagetitle != '', Dictionary.pagetitle, {$this->classKey}.pagetitle) as pagetitle",
"if(Dictionary.longtitle != '', Dictionary.longtitle, {$this->classKey}.longtitle) as longtitle",
"if(Dictionary.content != '', Dictionary.content, {$this->classKey}.content) as content",
"if(Dictionary.menutitle != '', Dictionary.menutitle, {$this->classKey}.menutitle) as menutitle",
));
}
return $c;
}
}
return 'modSocietyWebResourcesGetdataProcessor';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment