Add localized labels in subdef editing

This commit is contained in:
Romain Neutron
2013-06-17 18:54:10 +02:00
parent 9f29b403f7
commit 5b06914bca
5 changed files with 38 additions and 9 deletions

View File

@@ -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)) {