doujumiao5024 2018-06-01 14:37
浏览 75
已采纳

在TYPO3插件中创建新内容cType时使用FlexForm

I'm adding new content types to my TYPO3 and I want to use FlexForms to define each content type options form.

I have followed this example: https://docs.typo3.org/typo3cms/extensions/fluid_styled_content/latest/AddingYourOwnContentElements/

And modified it to use FlexForms from this example: https://wiki.typo3.org/Extension_Development,_using_Flexforms

But I believe I don't quite understand the settings in Configuration/TCA/Overrrides/tt_contant.php:

// Adds content new content elements
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPlugin(
    [
        'LLL:EXT:lu_content/Resources/Private/Language/locallang.xlf:contacts.title',
        'lu_content__contacts',
        \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('lu_content').'Resources/Public/Icons/Contacts.svg',
    ],
    'CType',
    'lu_content'
);

$GLOBALS['TCA']['tt_content']['types']['lu_content__contacts']['showitem']                       = 'CType;;;1-1-1,pi_flexform;;;1-1-1';
$GLOBALS['TCA']['tt_content']['columns']['pi_flexform']['config']['ds'][',lu_content__contacts'] = 'FILE:EXT:lu_content/Configuration/FlexForms/Contacts.xml';

The form works, but looks like this: enter image description here

How do I get the form not to fall under Plugin Options?

And how do I make the title/header to be used in to list view? Currently i get [notitle] after save in the content list.

enter image description here

Thank you in advance.

PS: I'm currently developing on TYPO3 v7 but with support for v8.

  • 写回答

1条回答 默认 最新

  • dstt1818 2018-06-09 08:38
    关注

    The Text for the tab as well as the arrangement of any tabs and fields is defined for general plugins in

    $GLOBALS['TCA']['tt_content']['types']['list']
    

    If you have defined an own CType it's quite probable that you wish to define own fields, palettes and types, hide standard-fields and perhaps replace default labels. The whole configuration for tt_content is quite complicated as it is used for all different content-elements and it can be seen in backend below System -> Configuration -> GLOBALS[TCA]:

    enter image description here

    The simplest option is to replace the label for the tab in $GLOBALS['TCA']['tt_content']['types']['list'].
    Before / Default:

    --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general,--palette--;;general,--palette--;;headers,--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.plugin,list_type;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:list_type_formlabel,pages;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:pages.ALT.list_formlabel,recursive,--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.appearance,--palette--;;frames,--palette--;;appearanceLinks,--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:language,--palette--;;language,--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:access,--palette--;;hidden,--palette--;;access,--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:categories,--div--;LLL:EXT:lang/Resources/Private/Language/locallang_tca.xlf:sys_category.tabs.category,categories,--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:notes,rowDescription,--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:extended
    

    After / location to fill with own label: (look for ###YOUR_LABEL###):

    --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general,--palette--;;general,--palette--;;headers,--div--;###YOUR_LABEL###,list_type;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:list_type_formlabel,pages;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:pages.ALT.list_formlabel,recursive,--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.appearance,--palette--;;frames,--palette--;;appearanceLinks,--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:language,--palette--;;language,--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:access,--palette--;;hidden,--palette--;;access,--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:categories,--div--;LLL:EXT:lang/Resources/Private/Language/locallang_tca.xlf:sys_category.tabs.category,categories,--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:notes,rowDescription,--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:extended
    

    and a more difficult approach would be to define an own type in $GLOBALS['TCA']['tt_content']['types'].

    Here you find The documentation about TCA.

    For your case are especially interesting the following chapters:

    But if you want to change labels or other configuration of single fields you'd had to refer to the chapter / configuration about columns.
    In the area ctrl you still can define some general options like sorting-fields or the behavior when the whole element is copied, have a look in that chapter to get an impression about all options. Also the desired and default label and value-field is configured there with

    $GLOBALS['TCA']['tt_content']['ctrl']['label']
    

    its also possible to combine two or more fields for the default display:

    $GLOBALS['TCA']['tt_content']['ctrl']['label'] = 'header';
    $GLOBALS['TCA']['tt_content']['ctrl']['label_alt'] = 'subheader';
    

    you might still want to add the option

    $GLOBALS['TCA']['tt_content']['ctrl']['label_alt_force'] = 1;
    

    Configuring the form for a plugin can take quite some time even to understand all the options, but in general there are very much options to individualize it related to many needs. It's even possible to define user-functions to handle and display own options in the form which are not covered by the existing options.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 cgictest.cgi文件无法访问
  • ¥20 删除和修改功能无法调用
  • ¥15 kafka topic 所有分副本数修改
  • ¥15 小程序中fit格式等运动数据文件怎样实现可视化?(包含心率信息))
  • ¥15 如何利用mmdetection3d中的get_flops.py文件计算fcos3d方法的flops?
  • ¥40 串口调试助手打开串口后,keil5的代码就停止了
  • ¥15 电脑最近经常蓝屏,求大家看看哪的问题
  • ¥60 高价有偿求java辅导。工程量较大,价格你定,联系确定辅导后将采纳你的答案。希望能给出完整详细代码,并能解释回答我关于代码的疑问疑问,代码要求如下,联系我会发文档
  • ¥50 C++五子棋AI程序编写
  • ¥30 求安卓设备利用一个typeC接口,同时实现向pc一边投屏一边上传数据的解决方案。