PHP Class Msieprawski\ResourceTable\Helpers\Column

Datei anzeigen Open project: msieprawski/resource-table Class Usage Examples

Public Methods

Method Description
__construct ( array $data, string $viewName = '' ) Sets column data provided by user with addColumn method
content ( null | stdClass | array $row = null ) : string Returns column content (depends on column configuration)
getDatabaseName ( ) : null | string Returns column's database name
hasRenderer ( ) : boolean Checks whether column has a defined renderer
index ( ) : null | string Returns column index
label ( ) : string Returns column label - to be used by view when rendering table
options ( ) : array Returns column array with options for searchable form
queryConditionType ( ) : string Returns query condition type By default ->where(.
renderer ( stdClass $row ) : mixed Returns renderer result (if exists) or null when not defined
searchType ( ) : string Returns column search type (if valid and provided)
searchable ( ) : boolean Checks if column is searchable
searchableContent ( array $config = [] ) : string Returns HTML with column search field
sortActive ( ) : boolean Checks whether column is active by current sort index
sortDirection ( ) : string Returns current column's sort direction
sortUrl ( ) : string Returns column sort link
sortable ( ) : boolean Checks whether column is sortable

Private Methods

Method Description
_getSortAnchor ( ) : string Returns column sort anchor (result depends on view name)
_optionsHTML ( ) : string Returns HTML with select options for searchable column
_sortDirection ( ) : string Returns current sort direction (order_dir) Returns default direction if not defined
_sortIndex ( ) : string | null Returns current sort index (order_by)

Method Details

__construct() public method

Sets column data provided by user with addColumn method
public __construct ( array $data, string $viewName = '' )
$data array
$viewName string - used when calling content method

content() public method

Returns column content (depends on column configuration)
public content ( null | stdClass | array $row = null ) : string
$row null | stdClass | array
return string

getDatabaseName() public method

Returns column's database name
public getDatabaseName ( ) : null | string
return null | string

hasRenderer() public method

Checks whether column has a defined renderer
public hasRenderer ( ) : boolean
return boolean

index() public method

Returns column index
public index ( ) : null | string
return null | string

label() public method

Returns column label - to be used by view when rendering table
public label ( ) : string
return string

options() public method

Returns column array with options for searchable form
public options ( ) : array
return array

queryConditionType() public method

. is used You can change it to for example ->having(.. if you used alias
public queryConditionType ( ) : string
return string

renderer() public method

Returns renderer result (if exists) or null when not defined
public renderer ( stdClass $row ) : mixed
$row stdClass
return mixed

searchType() public method

Returns column search type (if valid and provided)
public searchType ( ) : string
return string

searchable() public method

Checks if column is searchable
public searchable ( ) : boolean
return boolean

searchableContent() public method

Returns HTML with column search field
public searchableContent ( array $config = [] ) : string
$config array
return string

sortActive() public method

Checks whether column is active by current sort index
public sortActive ( ) : boolean
return boolean

sortDirection() public method

Returns current column's sort direction
public sortDirection ( ) : string
return string

sortUrl() public method

Returns column sort link
public sortUrl ( ) : string
return string

sortable() public method

Checks whether column is sortable
public sortable ( ) : boolean
return boolean