mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 07:23:13 +00:00
Add localized labels in subdef editing
This commit is contained in:
@@ -166,6 +166,17 @@ class databox_subdef
|
||||
return $this->labels;
|
||||
}
|
||||
|
||||
public function get_label($code, $substitute = true)
|
||||
{
|
||||
if (!isset($this->labels[$code]) && $substitute) {
|
||||
return $this->get_name();
|
||||
} elseif (isset($this->labels[$code])) {
|
||||
return $this->labels[$code];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* boolean
|
||||
*
|
||||
|
@@ -220,7 +220,7 @@ class databox_subdefsStructure implements IteratorAggregate, Countable
|
||||
* @param Array $options
|
||||
* @return databox_subdefsStructure
|
||||
*/
|
||||
public function set_subdef($group, $name, $class, $downloadable, $options)
|
||||
public function set_subdef($group, $name, $class, $downloadable, $options, $labels)
|
||||
{
|
||||
$dom_struct = $this->databox->get_dom_structure();
|
||||
|
||||
@@ -229,6 +229,14 @@ class databox_subdefsStructure implements IteratorAggregate, Countable
|
||||
$subdef->setAttribute('name', mb_strtolower($name));
|
||||
$subdef->setAttribute('downloadable', ($downloadable ? 'true' : 'false'));
|
||||
|
||||
foreach ($labels as $code => $label) {
|
||||
$child = $dom_struct->createElement('label');
|
||||
$labelElement = $child->appendChild($dom_struct->createTextNode($label));
|
||||
$lang = $child->appendChild($dom_struct->createAttribute('lang'));
|
||||
$lang->value = $code;
|
||||
$subdef->appendChild($child);
|
||||
}
|
||||
|
||||
foreach ($options as $option => $value) {
|
||||
|
||||
if (is_scalar($value)) {
|
||||
|
Reference in New Issue
Block a user