Elgg  Version 2.3
Public Member Functions | List of all members
Elgg\Views\TableColumn\ColumnFactory Class Reference

Factory for table column objects. More...

Public Member Functions

 fromView ($name, $heading=null, $vars=[])
 Make a column from one of the page/components/column/* views. More...
 
 fromProperty ($name, $heading=null)
 Make a column by reading a property of the item. More...
 
 fromMethod ($name, $heading=null, $args=[])
 Make a column by calling a method on the item. More...
 
 __call ($name, $arguments)
 Provide additional methods via hook and specified language keys. More...
 

Detailed Description

Factory for table column objects.

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 aselgg()->table_columnsprovides methods to create column objects based around existing views likepage/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.

Definition at line 42 of file ColumnFactory.php.

Member Function Documentation

Elgg\Views\TableColumn\ColumnFactory::__call (   $name,
  $arguments 
)

Provide additional methods via hook and specified language keys.

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.

Parameters
string$nameMethod name
array$argumentsArguments
Returns
TableColumn

Definition at line 137 of file ColumnFactory.php.

Elgg\Views\TableColumn\ColumnFactory::fromMethod (   $name,
  $heading = null,
  $args = [] 
)

Make a column by calling a method on the item.

Parameters
string$nameMethod name. e.g. "getSubtype", "getDisplayName"
string$headingHeading
array$argsMethod arguments
Returns
CallableColumn

Definition at line 102 of file ColumnFactory.php.

Elgg\Views\TableColumn\ColumnFactory::fromProperty (   $name,
  $heading = null 
)

Make a column by reading a property of the item.

Parameters
string$nameProperty name. e.g. "description", "email", "type"
string$headingHeading
Returns
CallableColumn

Definition at line 76 of file ColumnFactory.php.

Elgg\Views\TableColumn\ColumnFactory::fromView (   $name,
  $heading = null,
  $vars = [] 
)

Make a column from one of the page/components/column/* views.

Parameters
string$nameColumn name (view will be "page/components/column/$name")
string$headingOptional heading
array$varsView vars (item, item_vars, and type will be merged in)
Returns
ViewColumn

Definition at line 53 of file ColumnFactory.php.


The documentation for this class was generated from the following file: