Question

I'm in the process of creating my very first extension in Typo3 (version 4.5.22). I'm using Dmitry Dulepov's "TYPO3 Extension Development" book as a guide (a very useful reference). I used Kickstarter to get things going, and one of the things it generated was a $TCA that goes along with my own table in the database.

Now, my understanding is that the TCA determines what options appear in the backend for my plugin, under "Plugin Options," when you create a new "Insert Plugin" content item. The problem is, this section remains blank. When I choose my plugin, there are no options displayed.

I was able to build a Flexform and get it to show up under "Plugin Options," but an extremely important component of my plugin is the ability to use the "suggest" form to search for records, and from what I've read, it's not possible to get those to work properly using Flexforms.

Am I missing a simple function in ext_tables to get my TCA to show up in the "Plugin Options" section? Sorry if I'm completely off-base here; the sheer complexity of Typo3 has left me in a bit of a daze.

Here's my ext_tables.php, which was generated by Kickstarter:

<?php
if (!defined('TYPO3_MODE')) {
    die ('Access denied.');
}

t3lib_extMgm::allowTableOnStandardPages('tx_newsbuilder_newsitems');


t3lib_extMgm::addToInsertRecords('tx_newsbuilder_newsitems');

$TCA['tx_newsbuilder_newsitems'] = array(
    'ctrl' => array(
        'title'     => 'LLL:EXT:newsbuilder/locallang_db.xml:tx_newsbuilder_newsitems',        
        'label'     => 'uid',    
        'tstamp'    => 'tstamp',
        'crdate'    => 'crdate',
        'cruser_id' => 'cruser_id',
        'default_sortby' => 'ORDER BY crdate',    
        'delete' => 'deleted',    
        'enablecolumns' => array(        
            'disabled' => 'hidden',
        ),
        'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY) . 'tca.php',
        'iconfile'          => t3lib_extMgm::extRelPath($_EXTKEY) . 'icon_tx_newsbuilder_newsitems.gif',
    ),
);

t3lib_div::loadTCA('tt_content');
$TCA['tt_content']['types']['list']['subtypes_excludelist'][$_EXTKEY.'_pi1'] = 'layout,select_key';


t3lib_extMgm::addPlugin(array(
    'LLL:EXT:newsbuilder/locallang_db.xml:tt_content.list_type_pi1',
    $_EXTKEY . '_pi1',
    t3lib_extMgm::extRelPath($_EXTKEY) . 'ext_icon.gif'
),'list_type');


if (TYPO3_MODE === 'BE') {
    $TBE_MODULES_EXT['xMOD_db_new_content_el']['addElClasses']['tx_newsbuilder_pi1_wizicon'] = t3lib_extMgm::extPath($_EXTKEY) . 'pi1/class.tx_newsbuilder_pi1_wizicon.php';
}

// Flexform
//$TCA['tt_content']['types']['list']['subtypes_addlist'] [$_EXTKEY . '_pi1'] = 'pi_flexform';
//t3lib_extMgm::addPiFlexFormValue($_EXTKEY . '_pi1', 'FILE:EXT:' . $_EXTKEY . '/pi1/flexform_ds.xml');


?>

Here, additionally, is my tca.php:

<?php
if (!defined('TYPO3_MODE')) {
    die ('Access denied.');
}

$TCA['tx_newsbuilder_newsitems'] = array(
    'ctrl' => $TCA['tx_newsbuilder_newsitems']['ctrl'],
    'interface' => array(
        'showRecordFieldList' => 'hidden,tt_news_uid,singleview_uid,fishback_uid,fishback_url,headline,subheading,link'
    ),
    'feInterface' => $TCA['tx_newsbuilder_newsitems']['feInterface'],
    'columns' => array(
        'hidden' => array(        
            'exclude' => 1,
            'label'   => 'LLL:EXT:lang/locallang_general.xml:LGL.hidden',
            'config'  => array(
                'type'    => 'check',
                'default' => '0'
            )
        ),
        'tt_news_uid' => array(        
            'exclude' => 0,        
            'label' => 'LLL:EXT:newsbuilder/locallang_db.xml:tx_newsbuilder_newsitems.tt_news_uid',        
            'config' => array(
                'type' => 'group',    
                'internal_type' => 'db',    
                'allowed' => 'NO_TABLE_NAME_AVAILABLE',    
                'size' => 1,    
                'minitems' => 0,
                'maxitems' => 1,
            )
        ),
        'singleview_uid' => array(        
            'exclude' => 0,        
            'label' => 'LLL:EXT:newsbuilder/locallang_db.xml:tx_newsbuilder_newsitems.singleview_uid',        
            'config' => array(
                'type' => 'group',    
                'internal_type' => 'db',    
                'allowed' => 'tt_news',    
                'size' => 1,    
                'minitems' => 0,
                'maxitems' => 1,
            )
        ),
        'fishback_uid' => array(        
            'exclude' => 0,        
            'label' => 'LLL:EXT:newsbuilder/locallang_db.xml:tx_newsbuilder_newsitems.fishback_uid',        
            'config' => array(
                'type' => 'group',    
                'internal_type' => 'db',    
                'allowed' => 'pages',    
                'size' => 1,    
                'minitems' => 0,
                'maxitems' => 1,
            )
        ),
        'fishback_url' => array(        
            'exclude' => 0,        
            'label' => 'LLL:EXT:newsbuilder/locallang_db.xml:tx_newsbuilder_newsitems.fishback_url',        
            'config' => array(
                'type'     => 'input',
                'size'     => '15',
                'max'      => '255',
                'checkbox' => '',
                'eval'     => 'trim',
                'wizards'  => array(
                    '_PADDING' => 2,
                    'link'     => array(
                        'type'         => 'popup',
                        'title'        => 'Link',
                        'icon'         => 'link_popup.gif',
                        'script'       => 'browse_links.php?mode=wizard',
                        'JSopenParams' => 'height=300,width=500,status=0,menubar=0,scrollbars=1'
                    )
                )
            )
        ),
        'headline' => array(        
            'exclude' => 0,        
            'label' => 'LLL:EXT:newsbuilder/locallang_db.xml:tx_newsbuilder_newsitems.headline',        
            'config' => array(
                'type' => 'text',
                'cols' => '48',    
                'rows' => '1',
            )
        ),
        'subheading' => array(        
            'exclude' => 0,        
            'label' => 'LLL:EXT:newsbuilder/locallang_db.xml:tx_newsbuilder_newsitems.subheading',        
            'config' => array(
                'type' => 'text',
                'cols' => '48',    
                'rows' => '1',
            )
        ),
        'link' => array(        
            'exclude' => 0,        
            'label' => 'LLL:EXT:newsbuilder/locallang_db.xml:tx_newsbuilder_newsitems.link',        
            'config' => array(
                'type'     => 'input',
                'size'     => '15',
                'max'      => '255',
                'checkbox' => '',
                'eval'     => 'trim',
                'wizards'  => array(
                    '_PADDING' => 2,
                    'link'     => array(
                        'type'         => 'popup',
                        'title'        => 'Link',
                        'icon'         => 'link_popup.gif',
                        'script'       => 'browse_links.php?mode=wizard',
                        'JSopenParams' => 'height=300,width=500,status=0,menubar=0,scrollbars=1'
                    )
                )
            )
        ),
    ),
    'types' => array(
        '0' => array('showitem' => 'hidden;;1;;1-1-1, tt_news_uid, singleview_uid, fishback_uid, fishback_url, headline, subheading, link')
    ),
    'palettes' => array(
        '1' => array('showitem' => '')
    )
);
?>
Was it helpful?

Solution

TCA is Table Configuration Array. It configures appearance of records from db tables in your TYPO3 BackEnd in Web -> List module. So, if you go to this module and create new entry for tx_newsbuilder_newsitems, you'll see your record create/edit form, as configured in tca.php and ext_tables.php.

Your plugin, inserted on a page, is a usual Content Element, saved in tt_content table, so it is shown, like defined in TCA of tt_content. But this table has configured pi_flexform field, which is of type flex and can contain flexible data inside, which FlexForm actually is. For this purpose you need to create a proper XML file for your FlexForm and instruct TYPO3 to use it.

In TYPO3 wiki you can find detailed information about FlexForms usage.

P.S. It should be possible to use suggest wizard in FlexForm, because FF notation is almost same as TCA notation and all the wizards should be available.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top