Fixed method to display options in the current local and not en_US.
This commit is contained in:
committed by
Julien Chanseaume
parent
1e0bb03804
commit
4aec6f4b3d
@@ -13,6 +13,7 @@
|
|||||||
namespace Thelia\Type;
|
namespace Thelia\Type;
|
||||||
|
|
||||||
use Propel\Runtime\ActiveQuery\ModelCriteria;
|
use Propel\Runtime\ActiveQuery\ModelCriteria;
|
||||||
|
use Thelia\Core\Translation\Translator;
|
||||||
use Thelia\Exception\TypeException;
|
use Thelia\Exception\TypeException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -67,8 +68,16 @@ class ModelValidIdType extends BaseType
|
|||||||
{
|
{
|
||||||
$queryClass = $this->expectedModelActiveRecordQuery;
|
$queryClass = $this->expectedModelActiveRecordQuery;
|
||||||
|
|
||||||
|
$query = $queryClass::create();
|
||||||
|
|
||||||
|
if (method_exists($query, "joinWithI18n")) {
|
||||||
|
if (null !== $locale = Translator::getInstance()->getLocale()) {
|
||||||
|
$query->joinWithI18n($locale);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$choices = array();
|
$choices = array();
|
||||||
foreach ($queryClass::create()->find() as $item) {
|
foreach ($query->find() as $item) {
|
||||||
$choices[$item->getId()] = method_exists($item, "getTitle") ? $item->getTitle() : $item->getId();
|
$choices[$item->getId()] = method_exists($item, "getTitle") ? $item->getTitle() : $item->getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user