PHP Class Elgg\Views\TableColumn\ColumnFactory

elgg_list_entities() can output tables by specifying $options['list_type'] = 'table' and by providing an array of TableColumn objects to $options['columns']. This service, available as elgg()->table_columns provides methods to create column objects based around existing views like page/components/column/*, properties, or methods. Numerous pre-existing methods are provided via __call() magic. See this method to find out how to add your own methods, override the existing ones, or completely replace a method via hook.
Datei anzeigen Open project: elgg/elgg

Public Methods

Method Description
__call ( string $name, array $arguments ) : Elgg\Views\TableColumn Provide additional methods via hook and specified language keys.
fromMethod ( string $name, string $heading = null, array $args = [] ) : CallableColumn Make a column by calling a method on the item
fromProperty ( string $name, string $heading = null ) : CallableColumn Make a column by reading a property of the item
fromView ( string $name, string $heading = null, array $vars = [] ) : ViewColumn Make a column from one of the page/components/column/* views.

Method Details

__call() public method

First, the hook table_columns:call is called. Details in docs/guides/hooks-list.rst. Then it checks existence of 3 language keys in order to defer processing to a local method: - "table_columns:fromView:$name" -> uses $this->fromView($name, ...). - "table_columns:fromProperty:$name" -> uses $this->fromProperty($name, ...). - "table_columns:fromMethod:$name" -> uses $this->fromMethod($name, ...). See the from*() methods for details.
public __call ( string $name, array $arguments ) : Elgg\Views\TableColumn
$name string Method name
$arguments array Arguments
return Elgg\Views\TableColumn

fromMethod() public method

Make a column by calling a method on the item
public fromMethod ( string $name, string $heading = null, array $args = [] ) : CallableColumn
$name string Method name. e.g. "getSubtype", "getDisplayName"
$heading string Heading
$args array Method arguments
return CallableColumn

fromProperty() public method

Make a column by reading a property of the item
public fromProperty ( string $name, string $heading = null ) : CallableColumn
$name string Property name. e.g. "description", "email", "type"
$heading string Heading
return CallableColumn

fromView() public method

Make a column from one of the page/components/column/* views.
public fromView ( string $name, string $heading = null, array $vars = [] ) : ViewColumn
$name string Column name (view will be "page/components/column/$name")
$heading string Optional heading
$vars array View vars (item, item_vars, and type will be merged in)
return ViewColumn