/**
* Render row item into template
* @param Row $row
* @return mixed
*/
public function render(Row $row)
{
/**
* Renderer function may be used
*/
try {
return $this->useRenderer($row);
} catch (DataGridColumnRendererException $e) {
/**
* Do not use renderer
*/
}
$value = parent::render($row);
if (!$value && !$this->icon) {
return NULL;
}
$a = Html::el('a')->href($this->createLink($this->grid, $this->href, $this->getItemParams($row, $this->params) + $this->parameters));
if (!empty($this->data_attributes)) {
foreach ($this->data_attributes as $key => $attr_value) {
$a->data($key, $attr_value);
}
}
if ($this->open_in_new_tab) {
$a->addAttributes(['target' => '_blank']);
}
if ($this->title) {
$a->title($this->title);
}
if ($this->class) {
$a->class($this->class);
}
$element = $a;
if ($this->icon) {
$a->addHtml(Html::el('span')->class(DataGrid::$icon_prefix . $this->icon));
if (strlen($value)) {
$a->addHtml(' ');
}
}
if ($this->isTemplateEscaped()) {
$a->addText($value);
} else {
$a->addHtml($value);
}
return $element;
}