sortby¶
- sortby¶
- Path
$GLOBALS['TCA'][$table]['ctrl']
- Type
string (field name)
- Scope
Proc. / Display
Field name, which is used to manage the order of the records when displayed.
The field contains an integer value which positions it at the correct position between other records from the same table on the current page. It should not be made editable by the user since the DataHandler will manage the content automatically.
This feature is used by e.g. the "pages" table and "tt_content" table (Content Elements) in order to output the pages or the content elements in the order expected by the editors. Extensions are expected to respect this field.
Typically the field name sorting is dedicated to this feature.
Attention
Do not confuse this property with default_sortby. The sortby field contains an integer and is managed by the DataHandler. If by accident a content column like "title" is set as sortby, the DataHandler will write these integers into that field, which is most likely not what you want. Use
default_sortby
in this case.EXT:my_extension/Configuration/TCA/tx_myextension_domain_model_something.php¶<?php return [ 'ctrl' => [ 'sortby' => 'sorting', ], ];