Elgg  Version 2.3
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:149
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:17
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
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
Table column rendered by a view.
Definition: ViewColumn.php:9
elgg_view($view, $vars=array(), $ignore1=false, $ignore2=false, $viewtype= '')
Return a parsed view.
Definition: views.php:336
__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
http free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
Definition: MIT-LICENSE.txt:5
if(!$display_name) $type
Definition: delete.php:27