Question

I need the same function like the TYPO3 standard. There you can choose a link (external Site, internal Site, File, etc.)

How can I do this?

Was it helpful?

Solution

You can find the TCA for the TYPO3 backend in the files typo3/sysext/cms/tbl_tt_content.php and typo3/sysext/cms/tbl_cms.php. Here you find the header_link example.

Solution for TYPO3 6.1 and lower:

'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',
    ),
),

Solution for 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',
    ),
),

Solution for TYPO3 8.x:

'header_link' => array(
    'label' => 'LLL:EXT:cms/locallang_ttc.xml:header_link',
    'exclude' => 1,
    'config' => array(
        'type' => 'input',
        'renderType' => 'inputLink',
    ),
),

OTHER TIPS

The TCA looks slightly different in the new version 7 of TYPO3:

        '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'
            )
        ),

In TYPO3 8.x, this is very simple, just add 'renderType' => 'inputLink' to your input field.

Following will work for 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',
            ),
),
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top