Elgg  Version 3.0
ViewColumn.php
Go to the documentation of this file.
1 <?php
2 namespace Elgg\Views\TableColumn;
3 
5 
9 class ViewColumn implements TableColumn {
10 
14  private $heading;
15 
19  private $view;
20 
24  private $vars;
25 
33  public function __construct($view, $heading = null, $vars = []) {
34  $this->view = $view;
35  $this->vars = $vars;
36 
37  if (!is_string($heading)) {
38  $heading = elgg_echo("ViewColumn:view:$view");
39  }
40  $this->heading = $heading;
41  }
42 
46  public function renderHeading() {
47  return $this->heading;
48  }
49 
53  public function renderCell($item, $type, $item_vars) {
54  $vars = array_merge($this->vars, [
55  'item' => $item,
56  'item_vars' => $item_vars,
57  'type' => $type,
58  ]);
59 
60  return elgg_view($this->view, $vars);
61  }
62 }
$CONFIG view
The current view type.
Definition: config.php:135
if(!$item instanceof ElggMenuItem) $item_vars
Definition: item.php:17
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:53
if(!$items) $item
Definition: delete.php:13
renderHeading()
{Get the rendered heading cell as HTML.Cell will be auto-wrapped with a TH element if the returned st...
Definition: ViewColumn.php:46
$type
Definition: delete.php:21
elgg_echo($message_key, array $args=[], $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
Table column rendered by a view.
Definition: ViewColumn.php:9
__construct($view, $heading=null, $vars=[])
Constructor.
Definition: ViewColumn.php:33
A renderer for a column of table cells and a header.
Definition: TableColumn.php:7
elgg_view($view, $vars=[], $viewtype= '')
Return a parsed view.
Definition: views.php:246