/** Takes a PkModel instance & $attname, and formats/wraps them as * a label & value. If $tpl is provided, should have keys for 'pk_lbl' & * 'pk_val'. Otherwise, a default is constructed * * @param PkModel $model * @param string $attname * @param PartialSet $tpl * @return stringable HTML representation */ public function mkAttDesc($model, $attname, $tpl = null) { if (!$model instanceof PkModel) { return null; } if (!ne_string($attname)) { return null; } if ($tpl instanceof PartialSet) { $tpl = $tpl->copy(); } else { $tpl = new PkHtmlRenderer(); $tpl[] = "<div class='pk-wrapper'>\n<div class='pk-lbl'>\n"; $tpl['pk_lbl'] = null; $tpl[] = "\n</div>\n<div class='pk-val'>\n"; $tpl['pk_val'] = null; $tpl[] = "\n</div>\n</div>\n"; } $tpl['pk_lbl'] = $model->attdesc($attname); $tpl['pk_val'] = $model->{$attname}; return $tpl; }