diff --git a/Entity/CustomField.php b/Entity/CustomField.php index 5d1a69758..0964867fc 100644 --- a/Entity/CustomField.php +++ b/Entity/CustomField.php @@ -163,9 +163,24 @@ class CustomField * * @return array */ - public function getName() + public function getName($locale = null) { - return $this->name; + if ($locale) { + if (isset($this->name[$locale])) { + return $this->name[$locale]; + } else { + foreach ($this->name as $name) { + if (!empty($name)) { + return $name; + } + } + } + + return ''; + + } else { + return $this->name; + }; } /** diff --git a/Resources/views/CustomField/index.html.twig b/Resources/views/CustomField/index.html.twig index 38147c6c0..eac49fbd8 100644 --- a/Resources/views/CustomField/index.html.twig +++ b/Resources/views/CustomField/index.html.twig @@ -17,7 +17,7 @@ {% for entity in entities %} {{ entity.id }} - {{ entity.label }} + {{ entity.name(app.request.locale) }} {{ entity.type }} {{ entity.active }}