Ublaboo\DataGrid\Column\Column::render PHP Method

render() public method

Render row item into template
public render ( Row $row ) : mixed
$row Ublaboo\DataGrid\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
             */
        }
        /**
         * Or replacements may be applied
         */
        list($do_replace, $replaced) = $this->applyReplacements($row);
        if ($do_replace) {
            return $replaced;
        }
        return $this->getColumnValue($row);
    }

Usage Example

コード例 #1
0
ファイル: ColumnLink.php プロジェクト: ublaboo/datagrid
 /**
  * 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;
 }
All Usage Examples Of Ublaboo\DataGrid\Column\Column::render