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

在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.

图片转代码服务由CSDN问答提供 功能建议

我正在向TYPO3添加新内容类型,我想使用FlexForms定义每个内容类型选项表单。

我遵循了这个例子: https://docs.typo3.org/typo3cms/extensions/fluid_styled_content/latest/AddingYourOwnContentElements/

并修改它以使用此示例中的FlexForms: https://wiki.typo3.org/Extension_Development,_using_Flexforms

但是 我相信我不太了解 Configuration / TCA / Overrrides / tt_contant.php 中的设置:

  //添加内容新内容 elements 
 \ TYPO3 \ CMS \ Core \ Utility \ ExtensionManagementUtility :: addPlugin(
 [
'LLL:EXT:lu_content / Resources / Private / Language / locallang.xlf:contac  ts.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 '] [' 列 '] [' pi_flexform '] [' 配置 '] [' DS'  ] [',lu_content__contacts'] ='文件:EXT:lu_content / Configuration / FlexForms / Contacts.xml'; 
   
 
 

表单有效,但如下所示:

如何让表格插入插件选项?

如何将标题/标题用于列表视图?目前我在保存到内容列表后得到[notitle]。

提前感谢您。

PS:我目前正在开发TYPO3 v7,但支持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.

    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题