syuichi-tsuji
1/27/2013 - 7:39 AM

[concrete5] Hardcoded Search block only search in current language site tree

[concrete5] Hardcoded Search block only search in current language site tree

<?php

Loader::model('section', 'multilingual');

$ms = MultilingualSection::getCurrentSection();
if (is_object($ms)) {
	$lang = $ms->getLanguage();
	$search = BlockType::getByHandle('search');
	$search->controller->title = t('Site Search');
	$search->controller->buttonText = t('Search');
	$search->controller->baseSearchPath = $ms->getCollectionPath();
	$search->controller->searchUnderCID = $ms->getCollectionID();
	$search->controller->resultsURL = '/' . $lang . '/search';
	$search->render('view');
}
?>