本文整理汇总了PHP中Thelia\Model\ConfigQuery::getDefaultLangWhenNoTranslationAvailable方法的典型用法代码示例。如果您正苦于以下问题:PHP ConfigQuery::getDefaultLangWhenNoTranslationAvailable方法的具体用法?PHP ConfigQuery::getDefaultLangWhenNoTranslationAvailable怎么用?PHP ConfigQuery::getDefaultLangWhenNoTranslationAvailable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Thelia\Model\ConfigQuery
的用法示例。
在下文中一共展示了ConfigQuery::getDefaultLangWhenNoTranslationAvailable方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderDefault
public function renderDefault(array $param = array(), $status = 200)
{
$data = array();
foreach (LangQuery::create()->find() as $lang) {
$data[LangUrlForm::LANG_PREFIX . $lang->getId()] = $lang->getUrl();
}
$langUrlForm = $this->createForm(AdminForm::LANG_URL, 'form', $data);
$this->getParserContext()->addForm($langUrlForm);
return $this->render('languages', array_merge($param, array('lang_without_translation' => ConfigQuery::getDefaultLangWhenNoTranslationAvailable(), 'one_domain_per_lang' => ConfigQuery::isMultiDomainActivated())), $status);
}
示例2: renderDefault
public function renderDefault(array $param = array())
{
$data = array();
foreach (LangQuery::create()->find() as $lang) {
$data[LangUrlForm::LANG_PREFIX . $lang->getId()] = $lang->getUrl();
}
$langUrlForm = new LangUrlForm($this->getRequest(), 'form', $data);
$this->getParserContext()->addForm($langUrlForm);
return $this->render('languages', array_merge($param, array('lang_without_translation' => ConfigQuery::getDefaultLangWhenNoTranslationAvailable(), 'one_domain_per_lang' => ConfigQuery::read("one_domain_foreach_lang", false))));
}
示例3: getProduct
public function getProduct(ConnectionInterface $con = null, $locale = null)
{
$product = parent::getProduct($con);
$translation = $product->getTranslation($locale);
if ($translation->isNew()) {
if (ConfigQuery::getDefaultLangWhenNoTranslationAvailable()) {
$locale = Lang::getDefaultLanguage()->getLocale();
}
}
$product->setLocale($locale);
return $product;
}
示例4: getFrontEndI18n
/**
* @param ModelCriteria $search
* @param $requestedLocale
* @param array $columns
* @param null $foreignTable
* @param string $foreignKey
* @param bool $forceReturn
* @param string $forceReturn
*/
public static function getFrontEndI18n(ModelCriteria &$search, $requestedLocale, $columns, $foreignTable, $foreignKey, $forceReturn = false, $localeAlias = null)
{
if (!empty($columns)) {
if ($foreignTable === null) {
$foreignTable = $search->getTableMap()->getName();
$aliasPrefix = '';
} else {
$aliasPrefix = $foreignTable . '_';
}
if ($localeAlias === null) {
$localeAlias = $search->getTableMap()->getName();
}
$defaultLangWithoutTranslation = ConfigQuery::getDefaultLangWhenNoTranslationAvailable();
$requestedLocaleI18nAlias = $aliasPrefix . 'requested_locale_i18n';
$defaultLocaleI18nAlias = $aliasPrefix . 'default_locale_i18n';
if ($defaultLangWithoutTranslation == Lang::STRICTLY_USE_REQUESTED_LANGUAGE) {
$requestedLocaleJoin = new Join();
$requestedLocaleJoin->addExplicitCondition($localeAlias, $foreignKey, null, $foreignTable . '_i18n', 'ID', $requestedLocaleI18nAlias);
$requestedLocaleJoin->setJoinType($forceReturn === false ? Criteria::INNER_JOIN : Criteria::LEFT_JOIN);
$defaultLocaleJoin = new Join();
$defaultLocaleJoin->addExplicitCondition($localeAlias, $foreignKey, null, $foreignTable . '_i18n', 'ID', $defaultLocaleI18nAlias);
$search->addJoinObject($requestedLocaleJoin, $requestedLocaleI18nAlias)->addJoinCondition($requestedLocaleI18nAlias, '`' . $requestedLocaleI18nAlias . '`.LOCALE = ?', $requestedLocale, null, \PDO::PARAM_STR);
$search->addJoinObject($defaultLocaleJoin, $defaultLocaleI18nAlias)->addJoinCondition($defaultLocaleI18nAlias, '`' . $defaultLocaleI18nAlias . '`.LOCALE <> ?', $requestedLocale, null, \PDO::PARAM_STR);
$search->withColumn('NOT ISNULL(`' . $requestedLocaleI18nAlias . '`.`ID`)', $aliasPrefix . 'IS_TRANSLATED');
foreach ($columns as $column) {
$search->withColumn('`' . $requestedLocaleI18nAlias . '`.`' . $column . '`', $aliasPrefix . 'i18n_' . $column);
}
} else {
$defaultLocale = Lang::getDefaultLanguage()->getLocale();
$defaultLocaleJoin = new Join();
$defaultLocaleJoin->addExplicitCondition($localeAlias, $foreignKey, null, $foreignTable . '_i18n', 'ID', $defaultLocaleI18nAlias);
$defaultLocaleJoin->setJoinType(Criteria::LEFT_JOIN);
$search->addJoinObject($defaultLocaleJoin, $defaultLocaleI18nAlias)->addJoinCondition($defaultLocaleI18nAlias, '`' . $defaultLocaleI18nAlias . '`.LOCALE = ?', $defaultLocale, null, \PDO::PARAM_STR);
$requestedLocaleJoin = new Join();
$requestedLocaleJoin->addExplicitCondition($localeAlias, $foreignKey, null, $foreignTable . '_i18n', 'ID', $requestedLocaleI18nAlias);
$requestedLocaleJoin->setJoinType(Criteria::LEFT_JOIN);
$search->addJoinObject($requestedLocaleJoin, $requestedLocaleI18nAlias)->addJoinCondition($requestedLocaleI18nAlias, '`' . $requestedLocaleI18nAlias . '`.LOCALE = ?', $requestedLocale, null, \PDO::PARAM_STR);
$search->withColumn('NOT ISNULL(`' . $requestedLocaleI18nAlias . '`.`ID`)', $aliasPrefix . 'IS_TRANSLATED');
if ($forceReturn === false) {
$search->where('NOT ISNULL(`' . $requestedLocaleI18nAlias . '`.ID)')->_or()->where('NOT ISNULL(`' . $defaultLocaleI18nAlias . '`.ID)');
}
foreach ($columns as $column) {
$search->withColumn('CASE WHEN NOT ISNULL(`' . $requestedLocaleI18nAlias . '`.ID) THEN `' . $requestedLocaleI18nAlias . '`.`' . $column . '` ELSE `' . $defaultLocaleI18nAlias . '`.`' . $column . '` END', $aliasPrefix . 'i18n_' . $column);
}
}
}
}