Elgg  Version 6.1
CallableColumn.php
Go to the documentation of this file.
1 <?php
3 
5 
9 class CallableColumn implements TableColumn {
10 
14  protected $renderer;
15 
22  public function __construct(callable $renderer, protected $heading) {
23  $this->renderer = $renderer;
24  }
25 
29  public function renderHeading() {
30  return $this->heading;
31  }
32 
36  public function renderCell($item, $type, $item_vars) {
37  return call_user_func($this->renderer, $item, $type, $item_vars);
38  }
39 }
if(!$items) $item
Definition: delete.php:13
__construct(callable $renderer, protected $heading)
Constructor.
if(!$item instanceof ElggMenuItem) $item_vars
Definition: item.php:14
renderCell($item, $type, $item_vars)
{Render a value cell as HTML.Cell will be auto-wrapped with a TD element if the returned string doesn...
$type
Definition: delete.php:21
Table column rendered by a function.
A renderer for a column of table cells and a header.
Definition: TableColumn.php:7
renderHeading()
{Get the rendered heading cell as HTML.Cell will be auto-wrapped with a TH element if the returned st...