我正在 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' => '')
)
);
?>