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/Configuration/TCA/YourModel.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'] = 'property_1',
$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,
$GLOBALS['TCA']['tx_yourext_domain_model_yourmodelobject']['ctrl']['label_alt_force'] = true,

this will show labels as property_1,property_2,property_3

Scenario 3: Use a custom label

set up a file with a php class that creates the label, e.g. /typo3conf/ext/your_extension/Classes/Utility/class.label.php

!! Don’t forget to make that class available in the T3 autoloader by going to Admin Tools → Maintenance in the T3 Backend and, in the box Rebuild PHP Autoload Information hit the button Dump Autoload … if your T3 installation does not have a typo3conf/autoload folder you might need to include the class here instead

Example:

<?php
namespace YourVendor\YourExtension\Utility;

class label
{
    /**
     * @return void
     */

    function getObjectLabel(&$params, &$pObj)
    {
        if ($params['table'] != 'tx_yourext_domain_model_yourobject')
            return '';
        // Get complete record
        $rec = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord($params['table'], $params['row']['uid']);
        // Write to the label
        $params['title'] = $rec['property_2'].' '.$rec['property_1'];
    }
}
    }
}

and add the following to /typo3conf/ext/your_extension/Configuration/TCA/YourModel.php (either at the end or within the respective array elements, depending on how your TCA file is built):

$GLOBALS['TCA']['tx_yourext_domain_model_yourmodelobject']['ctrl']['label_userFunc'] = 'YourVendor\\YourExtension\\Utility\\label->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