DirectorObjectForm: say "inherited from ..."

This commit is contained in:
Thomas Gelf 2015-08-02 15:05:47 +02:00
parent 213df7e34b
commit 1e5deb2441
1 changed files with 5 additions and 4 deletions

View File

@ -133,7 +133,7 @@ abstract class DirectorObjectForm extends QuickForm
foreach ($props as $k => $v) { foreach ($props as $k => $v) {
if (property_exists($inherited, $k)) { if (property_exists($inherited, $k)) {
$this->setElementValue($k, $v, $inherited->$k, $origins->$k); $this->setElementValue($k, $v, $inherited->$k, $origins->$k);
} else { } else {
$this->setElementValue($k, $v); $this->setElementValue($k, $v);
} }
@ -291,16 +291,17 @@ abstract class DirectorObjectForm extends QuickForm
return; return;
} }
$txtInherited = $this->translate(' (inherited from "%s")');
if ($el instanceof Zf_Select) { if ($el instanceof Zf_Select) {
$multi = $el->getMultiOptions(); $multi = $el->getMultiOptions();
if (array_key_exists($inherited, $multi)) { if (array_key_exists($inherited, $multi)) {
$multi[null] = $multi[$inherited] . sprintf(' (%s)', $inheritedFrom); $multi[null] = $multi[$inherited] . sprintf($txtInherited, $inheritedFrom);
} else { } else {
$multi[null] = $this->translate('- inherited -'); $multi[null] = $this->translate($this->translate('- inherited -'));
} }
$el->setMultiOptions($multi); $el->setMultiOptions($multi);
} else { } else {
$el->setAttrib('placeholder', $inherited . sprintf(' (%s)', $inheritedFrom)); $el->setAttrib('placeholder', $inherited . sprintf($txtInherited, $inheritedFrom));
} }
} }