/** Navigate from $obj through $path. Convert the result to a (label)string.
* @return string The (label)string, for $kind >= 0 as HTML.
* @param PntObject $obj the object to start the navigation from
* @param string $path the path to navigate, as a series of property names separated by a dot
* @param int $kind if < 0 the label is returend. Otherwise this decides wheather line feeds should be converted into <BR>
* @param int $preformatAndTab the number of non breaking spaces to use for a tab.
if > 0 existing multiple spaces will be converted into non-breaking spaces
*/
function ($obj, $path, $kind=0, $preformatAndTab=0) {
if (!$obj) return '';
$cls = $obj->();
$pathId = "$cls>>$path";
if (!isSet($this->navs[$pathId])) {
Gen::includeClass('PntNavigation', 'pnt/meta');
try {
$nav = PntNavigation::getInstance($path, $cls);
} catch (PntError $err) {
trigger_error($err->(), E_USER_WARNING);
return '';
}
try {
$value = $nav->($obj);
} catch (PntError $err) {
trigger_error($err->(), E_USER_WARNING);
return '';
}
}
$prop = $nav->();
$conv = $this->($prop);
$label = $conv->($value, $prop->());
return $kind < 0
? $label
: $conv->($label, $kind, $preformatAndTab);
}
|