Loading...
Skip navigation
Please note that this documentation is for the most recent version of this extension. It may not be relevant for older versions. Related documentation can be found in the documentation directory of the extension.

Using custom field configuration

EXT:questions/Classes/Tca/Configuration.php

<?php declare(strict_types=1);
namespace CodingMs\Questions\Tca;
use CodingMs\AdditionalTca\Tca\Configuration as ConfigurationDefaults;
class Configuration extends ConfigurationDefaults
{
    /**
     * @param string $type
     * @param bool $required
     * @param bool $readonly
     * @param string $label
     * @param array $options
     * @return array
     */
    public static function get($type, $required = false, $readonly = false, $label = '', array $options=[]): array
    {
        switch ($type) {
            case 'questionCategories':
                $config = [
                    'type' => 'select',
                    'renderType' => 'selectMultipleSideBySide',
                    'foreign_table' => 'tx_questions_domain_model_questioncategory',
                    'MM' => 'tx_questions_question_questioncategory_mm',
                    'foreign_table_where' => 'ORDER BY title',
                    'size' => 10,
                    'autoSizeMax' => 30,
                    'minitems' => 1,
                    'maxitems' => 9999,
                    'multiple' => 0,
                ];
                break;
            case 'anotherCustom':
                // ...
                break;
            default:
                $config = parent::get($type, $required, $readonly, $label, $options);
                break;
        }
        if ($readonly) {
            $config['readOnly'] = true;
        }
        return $config;
    }
}

Usage in your own TCA:

return [
   'columns' => [
        'category' => [
            'exclude' => 0,
            'label' => $lll . '.category',
            'config' => \CodingMs\Questions\Tca\Configuration::get('questionCategories'),
        ],
    ],
];
Documentation
TYPO3 Additional-TCA Extension

TYPO3 Additional-TCA

This extension helps you to keep your TCA tidy and easy to maintain.

Menu

Contact request

You can contact us at any time

Stop! Playing in the meantime?
Stop! Playing in the meantime?
Stop! Playing in the meantime?

Stop! Playing in the meantime?

Break the highscore

Press Start
Contact request
Screenreader label
Security question
EU7_________AJK______
T______O______R___CZJ
ZYZ___NIH___CMI______
__X____M______Z___148
26X_________68T______

🎄 Bereits für's Weihnachtsmarketing?! 🎉

Entdecke den interaktiven Online-Adventskalender – perfekt für Websites, Shops und Kampagnen.

Gewinnspiele, Quiz, Gutscheine & mehr – alles, was Dein Weihnachtsmarketing braucht.

Für TYPO3-Websites Für andere Systeme