mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 13:54:23 +00:00
translate name to locale
This commit is contained in:
parent
43384a564c
commit
8b370bf544
@ -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;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -17,7 +17,7 @@
|
||||
{% for entity in entities %}
|
||||
<tr>
|
||||
<td><a href="{{ path('customfield_show', { 'id': entity.id }) }}">{{ entity.id }}</a></td>
|
||||
<td>{{ entity.label }}</td>
|
||||
<td>{{ entity.name(app.request.locale) }}</td>
|
||||
<td>{{ entity.type }}</td>
|
||||
<td>{{ entity.active }}</td>
|
||||
<td>
|
||||
|
Loading…
x
Reference in New Issue
Block a user