Skip to content

Commit

Permalink
interfaces: fix value lookup in LinkAddressField #8161
Browse files Browse the repository at this point in the history
  • Loading branch information
fichtner committed Dec 23, 2024
1 parent f159efd commit 27958ba
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,23 +113,27 @@ public function getValidators()
*/
public function getDescription()
{
if (isset(self::$known_addresses[$this->internalValue])) {
return self::$known_addresses[$this->internalValue];
$value = getCurrentValue();

if (isset(self::$known_addresses[$value])) {
return self::$known_addresses[$value];
}
return $this->internalValue;

return $value;
}

/**
* return either ipaddr or if field, only one should be used, addresses are preferred.
*/
public function __toString()
public function getCurrentValue()
{
$parent = $this->getParentNode();
foreach (['ipaddr', 'if'] as $fieldname) {
if (!empty((string)$parent->$fieldname)) {
return (string)$parent->$fieldname;
}
}
/* XXX not the current value? */
return (string)$this->internalValue;
}

Expand Down

0 comments on commit 27958ba

Please sign in to comment.