我需要与 TYPO3 标准相同的功能。在那里您可以选择一个链接(外部站点、内部站点、文件等)
我怎样才能做到这一点?
您可以在typo3/sysext/cms/tbl_tt_content.php 和typo3/sysext/cms/tbl_cms.php 文件中找到TYPO3 后端的TCA。在这里您可以找到 header_link 示例。
TYPO3 6.1 及更低版本的解决方案:
'header_link' => array(
'label' => 'LLL:EXT:cms/locallang_ttc.xml:header_link',
'exclude' => 1,
'config' => array(
'type' => 'input',
'size' => '50',
'max' => '256',
'eval' => 'trim',
'wizards' => array(
'_PADDING' => 2,
'link' => array(
'type' => 'popup',
'title' => 'LLL:EXT:cms/locallang_ttc.xml:header_link_formlabel',
'icon' => 'link_popup.gif',
'script' => 'browse_links.php?mode=wizard',
'JSopenParams' => 'height=300,width=500,status=0,menubar=0,scrollbars=1',
),
),
'softref' => 'typolink',
),
),
TYPO3 6.2.x - 7.6.x 的解决方案:
'header_link' => array(
'label' => 'LLL:EXT:cms/locallang_ttc.xml:header_link',
'exclude' => 1,
'config' => array(
'type' => 'input',
'size' => '50',
'max' => '256',
'eval' => 'trim',
'wizards' => array(
'_PADDING' => 2,
'link' => array(
'type' => 'popup',
'title' => 'LLL:EXT:cms/locallang_ttc.xml:header_link_formlabel',
'icon' => 'EXT:backend/Resources/Public/Images/FormFieldWizard/wizard_link.gif',
'module' => array(
'name' => 'wizard_element_browser',
'urlParameters' => array(
'mode' => 'wizard',
'act' => 'page'
)
),
'JSopenParams' => 'height=300,width=500,status=0,menubar=0,scrollbars=1',
),
),
'softref' => 'typolink',
),
),
TYPO3 8.x 的解决方案:
'header_link' => array(
'label' => 'LLL:EXT:cms/locallang_ttc.xml:header_link',
'exclude' => 1,
'config' => array(
'type' => 'input',
'renderType' => 'inputLink',
),
),
TCA 在 TYPO3 的新版本 7 中看起来略有不同:
'link' => array(
'label' => 'LLL:EXT:cms/locallang_ttc.xlf:header_link',
'exclude' => 1,
'config' => array(
'type' => 'input',
'size' => '50',
'max' => '1024',
'eval' => 'trim',
'wizards' => array(
'link' => array(
'type' => 'popup',
'title' => 'LLL:EXT:cms/locallang_ttc.xlf:header_link_formlabel',
'icon' => 'link_popup.gif',
'module' => array(
'name' => 'wizard_element_browser',
'urlParameters' => array(
'mode' => 'wizard'
)
),
'JSopenParams' => 'height=300,width=500,status=0,menubar=0,scrollbars=1'
)
),
'softref' => 'typolink'
)
),
在 TYPO3 8.x 中,这很简单,只需添加'renderType' => 'inputLink'
到您的input
字段中即可。
以下将适用于 TYPO3 7.6.X
'detailpage' => array(
'exclude' => 1,
'label' => 'LLL:EXT:myExt/Resources/Private/Language/locallang_db.xlf:tx_myExt_domain_model_mdl1.detailpage',
'config' => array(
'type' => 'input',
'size' => 30,
'eval' => 'trim',
'wizards' => array(
'_PADDING' => 2,
'link' => array(
'type' => 'popup',
'title' => 'LLL:EXT:cms/locallang_ttc.xml:header_link_formlabel',
'icon' => 'link_popup.gif',
'module' => array(
'name' => 'wizard_element_browser',
'urlParameters' => array(
'mode' => 'wizard',
'act' => 'page'
)
),
'JSopenParams' => 'height=300,width=500,status=0,menubar=0,scrollbars=1',
),
),
'softref' => 'typolink',
),
),