简体   繁体   English

TYPO3 TCA / Flexform链接向导:如何在后端显示页面名称?

[英]TYPO3 TCA/Flexform Link Wizard: How to display page name in the backend?

I created a custom content element using a fluid template for the frontend and a flexform xml file for the backend. 我使用前端的流体模板和后端的flexform xml文件创建了一个自定义内容元素。 The element has a link input field that makes use of the link wizard as explained in this question: 元素具有一个链接输入字段,该字段使用此问题中说明的链接向导:

How can i make a Link input Field in TCA 如何在TCA中创建链接输入字段

This works fine, but when I select a page from the page tree in the wizard, the input field displays the page ID (for example a "4"). 这可以正常工作,但是当我从向导的页面树中选择一个页面时,输入字段将显示页面ID(例如“ 4”)。 If I use the same (?) wizard within content elements that vanilla TYPO3 provides (for example the "shortcut" page type), the backend shows the name of the page in the link input field, not the ID. 如果在香草TYPO3提供的内容元素中使用相同的(?)向导(例如,“快捷方式”页面类型),则后端在链接输入字段中显示页面名称 ,而不是ID。 Is there an easy way to bring that functionality to my own element? 有没有简单的方法可以将该功能带入我自己的元素?

Remark: In my case, I don't use the PHP array writing style, but the XML one. 备注:就我而言,我不使用PHP数组编写样式,而是XML。 So what would be 'config' => array(...) in the PHP array is ... in my XML Flexform. 因此,PHP数组中的'config'=> array(...)在我的XML Flexform中是...。

This is standard behavior, see for an example Link field under the Header it also uses uid of the page, reason is simple: it allows to choose a page, but also external URL, email address or file reference - therefore it doesn't use page's title but its uid. 这是标准行为,请参见“ Header下的“ Link字段示例,它也使用页面的uid,原因很简单:它允许选择页面,但也可以选择外部URL,电子邮件地址或文件引用-因此不使用页面的标题,但其uid。

Second sample - shortcut to page definitely allows you to store only pages records, so it can render its title on the list - but doesn't allow you to mix different kinds of links. 第二个示例-页面快捷方式绝对允许您仅存储pages记录,因此可以在列表上显示其标题-但不允许您混合使用各种类型的链接。

If your ext will store always one type of link (ie. references to pages) you can use TCA field of type Group as showed in documentation 如果您的分机将始终存储一种链接类型(即对页面的引用),则可以使用文档中显示的Group类型的TCA字段

 'storage_pid' => array(
         'exclude' => 1,
         'label' => 'LLL:EXT:lang/locallang_tca.xlf:storage_pid',
         'config' => array(
                 'type' => 'group',
                 'internal_type' => 'db',
                 'allowed' => 'pages',
                 'size' => '1',
                 'maxitems' => '1',
                 'minitems' => '0',
                 'show_thumbs' => '1',
                 'wizards' => array(
                         'suggest' => array(
                                 'type' => 'suggest'
                         )
                 )
         )
 ),

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM