Grido\Components\Actions\Action::getElement PHP Method

getElement() public method

public getElement ( mixed $row ) : Nette\Utils\Html
$row mixed
return Nette\Utils\Html
    public function getElement($row)
    {
        $element = clone $this->getElementPrototype();
        if ($confirm = $this->getOption('confirm')) {
            $confirm = is_callable($confirm) ? call_user_func_array($confirm, [$row]) : $confirm;
            $value = is_array($confirm) ? vsprintf($this->translate(array_shift($confirm)), $confirm) : $this->translate($confirm);
            $element->setAttribute('data-grido-confirm', $value);
        }
        return $element;
    }

Usage Example

Beispiel #1
0
 /**
  * @param mixed $row
  * @return \Nette\Utils\Html
  * @internal
  */
 public function getElement($row)
 {
     $element = parent::getElement($row);
     $primaryValue = $this->grid->getProperty($row, $this->getPrimaryKey());
     $element->href($this->link('click!', $primaryValue));
     return $element;
 }