Building a TYPO3 extension in Extbase/Fluid

Configuring the backend list view of the extension records

This is about the table that shows the records/entries of your extension in the TYPO3 backend list view.

Label – the record field that is displayed in the list by default

By default the first field of your database table is displayed. Considering you have first_name and last_name as your first two fields you will only see the first name which would be a bit odd. See scenarios 2 and 3 to find out what you need to do in order to change that.

edit the file /typo3conf/ext/your_extension/ext_tables.php

Scenario 1 (default): Use one of the fields of your database table

change $GLOBALS['TCA']['tx_yourext_domain_model_yourmodelobject']['ctrl']['label'] = 'property_1',

Scenario 2: Use a comma-separated list of fields of your database table

add
$GLOBALS['TCA']['tx_yourext_domain_model_yourmodelobject']['ctrl']['label_alt'] = 'property_2,property_3',
$GLOBALS['TCA']['tx_yourext_domain_model_yourmodelobject']['ctrl']['label_alt_force'] = TRUE,

Scenario 3: Use a custom label

set up a file with a php class that creates the label, e.g. /typo3conf/ext/your_extension/Resources/class.your_classname.php
Example:

<?php
class your_classname
{
        function getObjectLabel(&$params, &$pObj)
        {
                if ($params['table'] != 'tx_yourext_domain_model_yourobject')
                        return '';
                // Get complete record
                $rec = t3lib_BEfunc::getRecord($params['table'], $params['row']['uid']);
                // Write to the label
                $params['title'] = $rec['property_2'].' '.$rec['property_1'];
        }
}
        }
}

include the created file in /typo3conf/ext/your_extension/ext_tables.php (somewhere at the top)

if (TYPO3_MODE == 'BE') {

        include_once (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('your_extension') . 'Resources/class.your_classname.php');

}
        include_once (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('your_extension') . 'Resources/class.your_classname.php');

}

and add this line at the end of that same file:

$GLOBALS['TCA']['tx_yourext_domain_model_yourmodelobject']['ctrl']['label_userFunc'] = 'your_classname->getObjectLabel',

List/Table: extended view

setting up the fields you see in extended view is a user based configuration, editable via the GUI. To do so, click the table name in order to have a small configuration form with the field list appear