Elgg  Version 6.0
ViewColumn.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Elgg\Views\TableColumn;
4 
6 
10 class ViewColumn implements TableColumn {
11 
12  protected string $heading;
13 
21  public function __construct(protected string $view, string $heading = null, protected array $vars = []) {
22  if (!is_string($heading)) {
23  $heading = elgg_echo("ViewColumn:view:{$view}");
24  }
25 
26  $this->heading = $heading;
27  }
28 
32  public function renderHeading() {
33  return $this->heading;
34  }
35 
39  public function renderCell($item, $type, $item_vars) {
40  $vars = array_merge($this->vars, [
41  'item' => $item,
42  'item_vars' => $item_vars,
43  'type' => $type,
44  ]);
45 
46  return elgg_view($this->view, $vars);
47  }
48 }
if(!$items) $item
Definition: delete.php:13
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...
Definition: ViewColumn.php:39
renderHeading()
{Get the rendered heading cell as HTML.Cell will be auto-wrapped with a TH element if the returned st...
Definition: ViewColumn.php:32
elgg_echo(string $message_key, array $args=[], string $language= '')
Elgg language module Functions to manage language and translations.
Definition: languages.php:17
$type
Definition: delete.php:21
Table column rendered by a view.
Definition: ViewColumn.php:10
elgg_view(string $view, array $vars=[], string $viewtype= '')
Return a parsed view.
Definition: views.php:156
if(!empty($avatar)&&!$avatar->isValid()) elseif(empty($avatar)) if(!$owner->saveIconFromUploadedFile('avatar')) if(!elgg_trigger_event('profileiconupdate', $owner->type, $owner)) $view
Definition: upload.php:39
__construct(protected string $view, string $heading=null, protected array $vars=[])
Constructor.
Definition: ViewColumn.php:21
$vars
Definition: theme.php:5
A renderer for a column of table cells and a header.
Definition: TableColumn.php:7