TCA Utility
Utility Class for working faster with the TCA.
- getColumnsByType ( $table, $type)
-
Returns active columns by TCA type.
- param string $table
-
The table name.
- param string $type
-
The type name.
Example:
|
var_dump(TcaUtility::getColumnsByType('tt_content', 'html')); // ['CType', 'colPos', 'header', 'bodytext', 'layout', 'frame_class', ... ] var_dump(TcaUtility::getColumnsByType('tt_content', 'image')); // ['CType', 'colPos', 'header', ..., 'image', 'imagewidth', 'imageheight', ...]
Copied!- Returns
-
List of column names.
- getColumnsByRow ( $table, $row)
-
Returns active columns based on a table record.
- param string $table
-
The table name.
- param array $row
-
The table record.
Example:
// Shorthand for: TcaUtility::getColumnsByType( TcaUtility::getTypeFromRow( $row )); // Example output, see above under "getColumnsByType".
Copied!- Returns
-
List of column names.
- getColumnsByTable ( $table)
-
Returns all default (first type) columns from a table.
- param string $table
-
The table name.
- Returns
-
List of column names.
- getTypeFromRow ( $table, $row)
-
Returns actice TCA type based on a table record.
- param string $table
-
The table name.
- param array $row
-
The table record.
- Returns
-
Name of the type will fallback to default type when no individual type is found.
- getVisibleColumnsByRow ( $table, $row)
-
Just return the columns which are visible for the current Backend User, respects current active display conditions of fields.
- param string $table
-
The table name.
- param array $row
-
The table record.
- Returns
-
List of column names.
- getTypeFieldOfTable ( $table)
-
Returns the column name which contains the "type" value from a table.
- param string $table
-
The table name.
- Returns
-
The name of the "type" column.
- getLabelFieldOfTable ( $table)
-
Returns the column name which contains the "label" value from a table.
- param string $table
-
The table name.
- Returns
-
The name of the "label" column.
- getLabelFromRow ( $row, $table)
-
Returns the label from a table record.
- param array $row
-
The table record.
- param string $table
-
The table name.
Example:
TcaUtility::getLabelFromRow([ 'uid' => 3, 'doktype => 254', 'title' => 'Elemente', /* ... */ ], 'pages'); // returns "Elemente"
Copied!- Returns
-
The label or "null" when empty.
- mapStringListToColumns ( $list, $table = null, $extendedList = false)
-
Converts a comma-separated list of TCA Columns (a,b,c) to [a,b,c]. Also columns of containing pallets will be resolved (if parameter table is available).
- param string $list
-
Comma-separated list of TCA Columns.
- param string $table
-
The table name.
- param bool $extendedList
-
Flag for returning extendedList.
- Returns
-
List of column names or list of [column name | label] when $extendedList is active.
- getFieldDefinition ( $table, $column, $type = null)
-
Returns the current TCA field definition from a table column. Also resolves column overrides when parameter "type" is set.
- param string $table
-
The table name.
- param string $column
-
The column name.
- param null|string $type
-
The type to respect column overrides.
- Returns
-
The field definition or "null" when no field definition is found.
- getFieldConfig ( $table, $column, $type = null)
-
Returns the TCA field configuration from a table column.
- param string $table
-
The table name.
- param string $column
-
The column name.
- param null|string $type
-
The type to respect column overrides.
- Returns
-
The field configuration or "null" when no field configuration is found.
- remapItemArrayToKeybasedList ( $items)
-
Converts a TCA item array to a key-based list.
- param array $items
-
TCA item array.
Example:
TcaUtility::remapItemArrayToKeybasedList([['LLL:.../locallang.xlf:creation', 'uid'], ['LLL:.../locallang.xlf:backendsorting', 'sorting']]); // returns: [ 'uid' => [ 'label' => 'LLL:.../locallang.xlf:creation', 'icon' => null ], 'sorting' => [ 'label' => 'LLL:.../locallang.xlf:backendsorting', 'icon' => null ] ]
Copied!- Returns
-
Key-based list.
- getLabelOfSelectedItem ( $value, $column, $table, $type = null, $localize = true)
-
Load the backend label from a selected item.
- param string $value
-
The selected item. F.e ['LLL:.../locallang.xlf:backendsorting', 'sorting']
- param string $column
-
Column name which contains the selected item.
- param string $table
-
The table name.
- param null|string $type
-
The type to respect column overrides.
- param boolean $localize
-
If false return the raw value, otherwise return the translated value.
- Returns
-
The label.
- getL10nConfig ( $table)
-
Returns the TCA language fields from a table or null, if not set.
- param string $table
-
The table name.
- Returns
-
TCA language fields from a table or null, if not set