1

我正在 Typo3(版本 4.5.22)中创建我的第一个扩展。我正在使用 Dmitry Dulepov 的“TYPO3 Extension Development”一书作为指南(非常有用的参考资料)。我使用 Kickstarter 让事情顺利进行,它生成的其中一件事是一个 $TCA,它与我自己在数据库中的表一起使用。

现在,我的理解是,当您创建新的“插入插件”内容项时,TCA 会在“插件选项”下为我的插件确定哪些选项出现在后端。问题是,这部分仍然是空白的。当我选择我的插件时,没有显示任何选项。

我能够构建一个 Flexform 并让它显示在“插件选项”下,但我的插件的一个极其重要的组件是能够使用“建议”表单来搜索记录,从我读过的内容来看,使用 Flexforms 无法让它们正常工作。

我是否缺少 ext_tables 中的一个简单函数来让我的 TCA 显示在“插件选项”部分?对不起,如果我在这里完全偏离基地;Typo3 的复杂性让我有点发呆。

这是我的 ext_tables.php,它是由 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');


?>

另外,这里是我的 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' => '')
    )
);
?>
4

1 回答 1

1

TCA是表配置数组。它在Web -> 列表模块中配置 TYPO3 后端中的 db 表中的记录的外观。因此,如果您转到此模块并为 创建新条目tx_newsbuilder_newsitems,您将看到您的记录创建/编辑表单,如 和 中配置的tca.php那样ext_tables.php

插入到页面上的插件是一个常见的内容元素,保存在tt_content表中,因此它被显示,就像在 tt_content 的 TCA 中定义的那样。但是这个表配置了pi_flexform字段,它是flex类型的,里面可以包含灵活的数据,其实就是flexform。为此,您需要为您的 FlexForm 创建一个适当的 XML 文件并指示 TYPO3 使用它。

在 TYPO3 wiki中,您可以找到有关 FlexForms 使用的详细信息。

PS 应该可以在 FlexForm 中使用建议向导,因为 FF 表示法与 TCA 表示法几乎相同,并且所有向导都应该可用。

于 2013-03-27T22:40:51.193 回答