Allow only certain link types in TYPO3 link wizard


/ Published in: TYPO3
Save to your folder(s)

This example adds a link field to every page's 'Extended' properties tab.

The example shows only the 'Page' and 'External URL' options in the link selection GUI. The contents of blindLinkOptions are the fields that will be hidden in the link wizard. Your options for that list are:

* file
* mail
* page
* folder
* url

Similar to blindLinkOptions, you an set an *allowedExtensions* element in the params array, with a comma-separated list of allowed file extensions. By default, all extensions are allowed.


Copy this code and paste it in your HTML
  1. <?php
  2. if (!defined('TYPO3_MODE')) {
  3. die ('Access denied.');
  4. }
  5.  
  6. $tempColumns = array (
  7. 'tx_someextension_somecolumn' => array (
  8. 'exclude' => 0,
  9. 'label' => 'My Link Field',
  10. 'config' => array (
  11. 'type' => 'input',
  12. 'size' => '15',
  13. 'max' => '255',
  14. 'checkbox' => '',
  15. 'eval' => 'trim',
  16. 'wizards' => array(
  17. '_PADDING' => 2,
  18. 'link' => array(
  19. 'type' => 'popup',
  20. 'title' => 'Link',
  21. 'icon' => 'link_popup.gif',
  22. 'script' => 'browse_links.php?mode=wizard',
  23. 'JSopenParams' => 'height=300,width=500,status=0,menubar=0,scrollbars=1',
  24. 'params' => array(
  25. 'blindLinkOptions' => 'file,mail,folder'
  26. )
  27. )
  28. )
  29. )
  30. ),
  31. );
  32.  
  33.  
  34. t3lib_div::loadTCA('pages');
  35. t3lib_extMgm::addTCAcolumns('pages',$tempColumns,1);
  36. t3lib_extMgm::addToAllTCAtypes('pages','tx_someextension_somecolumn;;;;1-1-1');
  37. t3lib_extMgm::addStaticFile($_EXTKEY, 'Configuration/TypoScript', 'Mobile Counterparts');
  38.  
  39.  
  40. ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.