public function getElementPrototype($tag, $key = NULL, Row $row = NULL)
{
/**
* Get cached element
*/
if (empty($this->el_cache[$tag])) {
$this->el_cache[$tag] = $el = $el = Html::el($tag);
} else {
$el = $this->el_cache[$tag];
}
/**
* If class was set by user via $el->class = '', fix it
*/
if (!empty($el->class) && is_string($el->class)) {
$class = $el->class;
unset($el->class);
$el->class[] = $class;
}
$el->class[] = "text-{$this->getAlign()}";
/**
* Method called from datagrid template, set appropriate classes and another attributes
*/
if ($key !== NULL && $row !== NULL) {
$el->class[] = "col-{$key}";
if ($tag == 'td') {
if ($this->isEditable()) {
$link = $this->grid->link('edit!', ['key' => $key, 'id' => $row->getId()]);
$el->data('datagrid-editable-url', $link);
$el->data('datagrid-editable-type', $this->editable_element[0]);
$el->data('datagrid-editable-attrs', json_encode($this->editable_element[1]));
}
}
}
return $el;
}