首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何利用FilesProcessor在TYPO3中为FluidStyledContent CE从表中获取图像引用?

如何利用FilesProcessor在TYPO3中为FluidStyledContent CE从表中获取图像引用?
EN

Stack Overflow用户
提问于 2017-04-24 13:22:33
回答 1查看 1.9K关注 0票数 0

我已经用Repeater字段在TYPO3 7.6中创建了自己的CE。我可以保存图像一切都很好-但我不能把它们放在我的液体模板?我想我要在DatabaseQueryProcessor和FilesProcessor上筑巢?但我搞不懂怎么回事?

ext_tables.sql

代码语言:javascript
运行
复制
CREATE TABLE tt_content (
    tx_repeater_cooperationsslider int(11) unsigned DEFAULT '0' NOT NULL
);

CREATE TABLE tx_repeater_cooperationsslider (
    uid int(11) NOT NULL auto_increment,
    pid int(11) DEFAULT '0' NOT NULL,
    parentid int(11) DEFAULT '0' NOT NULL,
    parenttable varchar(255) DEFAULT '' NOT NULL,
    sorting int(11) unsigned DEFAULT '0' NOT NULL,
    t3ver_oid int(11) unsigned DEFAULT '0' NOT NULL,
    t3ver_id int(11) DEFAULT '0' NOT NULL,
    t3ver_wsid int(11) DEFAULT '0' NOT NULL,
    t3ver_label varchar(255) DEFAULT '' NOT NULL,
    t3ver_state tinyint(4) DEFAULT '0' NOT NULL,
    t3ver_stage int(11) DEFAULT '0' NOT NULL,
    t3ver_count int(11) DEFAULT '0' NOT NULL,
    t3ver_tstamp int(11) DEFAULT '0' NOT NULL,
    t3ver_move_id int(11) DEFAULT '0' NOT NULL,
    tstamp int(11) unsigned DEFAULT '0' NOT NULL,
    crdate int(11) unsigned DEFAULT '0' NOT NULL,
    cruser_id int(11) unsigned DEFAULT '0' NOT NULL,
    deleted tinyint(4) unsigned DEFAULT '0' NOT NULL,
    hidden tinyint(4) unsigned DEFAULT '0' NOT NULL,
    starttime tinyint(4) unsigned DEFAULT '0' NOT NULL,
    endtime tinyint(4) unsigned DEFAULT '0' NOT NULL,
    sys_language_uid int(11) DEFAULT '0' NOT NULL,
    l10n_parent int(11) unsigned DEFAULT '0' NOT NULL,
    l10n_diffsource mediumblob,
    tx_repeater_image int(11) unsigned NOT NULL default '0',
    tx_repeater_buttonlink tinytext,
    PRIMARY KEY (uid),
    KEY parent (pid),
    KEY t3ver_oid (t3ver_oid,t3ver_wsid),
    KEY language (l10n_parent,sys_language_uid)
);

配置/TCA/Overrides/tt_content.php

代码语言:javascript
运行
复制
$tempColumns = array (
  'tx_repeater_cooperationsslider' => 
  array (
    'config' => 
    array (
      'type' => 'inline',
      'foreign_table' => 'tx_repeater_cooperationsslider',
      'foreign_field' => 'parentid',
      'foreign_table_field' => 'parenttable',
      'foreign_sortby' => 'sorting',
      'appearance' => 
      array (
        'enabledControls' => 
        array (
          'dragdrop' => '1',
        ),
        'collapseAll' => '1',
        'newRecordLinkTitle' => 'Neuen Förderer anlegen',
        'levelLinksPosition' => 'top',
        'useSortable' => '1',
        'showSynchronizationLink' => '1',
        'showAllLocalizationLink' => '1',
      ),
      'minitems' => '1',
      'maxitems' => '3',
      'behaviour' => 
      array (
        'localizationMode' => 'select',
      ),
    ),
    'exclude' => '1',
    'label' => 'Förderer',
  ),
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('tt_content', $tempColumns);


$GLOBALS['TCA']['tt_content']['columns']['CType']['config']['items'][] = array(
    'Kooperationen',
    'cooperationsslider',
);

$tempTypes = array (

  'cooperationsslider' => 
  array (
    'showitem' => '--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.general;general,
    header;Überschrift,bodytext;Teaser Text;;richtext:rte_transform[flag=rte_enabled|mode=ts_css],rte_enabled;LLL:EXT:cms/locallang_ttc.xlf:rte_enabled_formlabel,rowDescription;Button Text,header_link;Button Link,subheader;Subheadline,tx_repeater_cooperationsslider,
    --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access,
    --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.visibility;visibility,
    --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.access;access,
    --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.extended',
  )
);

$GLOBALS['TCA']['tt_content']['types'] += $tempTypes;

Configuration/TCA/tx_repeater_cooperationsslider.php

代码语言:javascript
运行
复制
<?php
return array (
  'ctrl' => 
  array (
    'title' => 'Meine Meldungen',
    'label' => 'tx_repeater_buttonlink',
    'tstamp' => 'tstamp',
    'crdate' => 'crdate',
    'cruser_id' => 'cruser_id',
    'dividers2tabs' => true,
    'versioningWS' => 2,
    'versioning_followPages' => true,
    'languageField' => 'sys_language_uid',
    'transOrigPointerField' => 'l10n_parent',
    'transOrigDiffSourceField' => 'l10n_diffsource',
    'delete' => 'deleted',
    'enablecolumns' => 
    array (
      'disabled' => 'hidden',
      'starttime' => 'starttime',
      'endtime' => 'endtime',
    ),
    'searchFields' => 'tx_repeater_buttonlink',
    'dynamicConfigFile' => '',
    'hideTable' => true,
  ),
  'interface' => 
  array (
    'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, tx_repeater_buttonlink, tx_repeater_image',
  ),
  'types' => 
  array (
    1 => 
    array (
      'showitem' => 'sys_language_uid;;;;1-1-1, l10n_parent, l10n_diffsource, hidden;;1,tx_repeater_image, tx_repeater_buttonlink, --div--;LLL:EXT:cms/locallang_ttc.xlf:tabs.access, starttime, endtime',
    ),
  ),
  'palettes' => 
  array (
    1 => 
    array (
      'showitem' => '',
    ),
  ),
  'columns' => 
  array (
    'sys_language_uid' => 
    array (
      'exclude' => 1,
      'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.language',
      'config' => 
      array (
        'type' => 'select',
        'renderType' => 'selectSingle',
        'foreign_table' => 'sys_language',
        'foreign_table_where' => 'ORDER BY sys_language.title',
        'items' => 
        array (
          0 => 
          array (
            0 => 'LLL:EXT:lang/locallang_general.xlf:LGL.allLanguages',
            1 => 0,
          ),
          1 => 
          array (
            0 => 'LLL:EXT:lang/locallang_general.xlf:LGL.default_value',
            1 => 0,
          ),
        ),
      ),
    ),
    'l10n_parent' => 
    array (
      'displayCond' => 'FIELD:sys_language_uid:>:0',
      'exclude' => 1,
      'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.l18n_parent',
      'config' => 
      array (
        'type' => 'select',
        'renderType' => 'selectSingle',
        'items' => 
        array (
          0 => 
          array (
            0 => '',
            1 => 0,
          ),
        ),
        'foreign_table' => 'tx_repeater_cooperationsslider',
        'foreign_table_where' => 'AND tx_repeater_cooperationsslider.pid=###CURRENT_PID### AND tx_repeater_cooperationsslider.sys_language_uid IN (-1,0)',
      ),
    ),
    'l10n_diffsource' => 
    array (
      'config' => 
      array (
        'type' => 'passthrough',
      ),
    ),
    't3ver_label' => 
    array (
      'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.versionLabel',
      'config' => 
      array (
        'type' => 'input',
        'size' => 30,
        'max' => 255,
      ),
    ),
    'hidden' => 
    array (
      'exclude' => 1,
      'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.hidden',
      'config' => 
      array (
        'type' => 'check',
      ),
    ),
    'starttime' => 
    array (
      'exclude' => 1,
      'l10n_mode' => 'mergeIfNotBlank',
      'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.starttime',
      'config' => 
      array (
        'type' => 'input',
        'size' => 13,
        'max' => 20,
        'eval' => 'datetime',
        'checkbox' => 0,
        'default' => 0,
        'range' => 
        array (
          'lower' => 1483398000,
        ),
      ),
    ),
    'endtime' => 
    array (
      'exclude' => 1,
      'l10n_mode' => 'mergeIfNotBlank',
      'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.endtime',
      'config' => 
      array (
        'type' => 'input',
        'size' => 13,
        'max' => 20,
        'eval' => 'datetime',
        'checkbox' => 0,
        'default' => 0,
        'range' => 
        array (
          'lower' => 1483398000,
        ),
      ),
    ),
    'parentid' => 
    array (
      'config' => 
      array (
        'type' => 'select',
        'renderType' => 'selectSingle',
        'items' => 
        array (
          0 => 
          array (
            0 => '',
            1 => 0,
          ),
        ),
        'foreign_table' => 'tt_content',
        'foreign_table_where' => 'AND tt_content.pid=###CURRENT_PID### AND tt_content.sys_language_uid IN (-1,###REC_FIELD_sys_language_uid###)',
      ),
    ),
    'parenttable' => 
    array (
      'config' => 
      array (
        'type' => 'passthrough',
      ),
    ),
    'sorting' => 
    array (
      'config' => 
      array (
        'type' => 'passthrough',
      ),
    ),
    'tx_repeater_buttonlink' => 
    array (
      'config' => 
      array (
        'type' => 'input',
        'wizards' => 
        array (
          '_PADDING' => '2',
          'link' => 
          array (
            'type' => 'popup',
            'title' => 'Link',
            'icon' => 'EXT:backend/Resources/Public/Images/FormFieldWizard/wizard_link.gif',
            'module' => 
            array (
              'name' => 'wizard_link',
              'urlParameters' => 
              array (
                'mode' => 'wizard',
              ),
            ),
            'JSopenParams' => 'height=300,width=500,status=0,menubar=0,scrollbars=1',
            'params' => 
            array (
              'blindLinkOptions' => 'file,mail',
            ),
          ),
        ),
        'size' => '40',
      ),
      'exclude' => '1',
      'label' => 'Link Meldung',
    ),

    'tx_repeater_image' => array(
            'exclude' => 1,
            'label' => 'Logo hochladen',
            'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
                'tx_repeater_image',
                array(
                    'appearance' => array(
                        'createNewRelationLinkTitle' => 'LLL:EXT:cms/locallang_ttc.xlf:images.addFileReference'
                    ),
                    'foreign_types' => array(
                        '0' => array(
                            'showitem' => '
                            --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
                            --palette--;;filePalette'
                        ),
                        \TYPO3\CMS\Core\Resource\File::FILETYPE_TEXT => array(
                            'showitem' => '
                            --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
                            --palette--;;filePalette'
                        ),
                        \TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => array(
                            'showitem' => '
                            --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
                            --palette--;;filePalette'
                        ),
                        \TYPO3\CMS\Core\Resource\File::FILETYPE_AUDIO => array(
                            'showitem' => '
                            --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
                            --palette--;;filePalette'
                        ),
                        \TYPO3\CMS\Core\Resource\File::FILETYPE_VIDEO => array(
                            'showitem' => '
                            --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
                            --palette--;;filePalette'
                        ),
                        \TYPO3\CMS\Core\Resource\File::FILETYPE_APPLICATION => array(
                            'showitem' => '
                            --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
                            --palette--;;filePalette'
                        )
                    ),
                    'maxitems' => 1
                ),
                $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']
            ),
        ),

  ),
);

打字本

代码语言:javascript
运行
复制
tt_content {

cooperationsslider < lib.fluidContent
    cooperationsslider {
        templateName = CooperationsSlider
        dataProcessing {


            20 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
            20 {
                if.isTrue.field = tx_repeater_cooperationsslider
                table = tx_repeater_cooperationsslider
                pidInList.field = pid
                where = parentid=###uid### AND deleted=0 AND hidden=0 AND 1=1
                orderBy = sorting
                markers {
                    uid.field = uid
                }
                as = data_tx_repeater_cooperationsslider
            }
30 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
            30 {
                 references {
                                table = tx_repeater_cooperationsslider
                                fieldName = tx_repeater_image
                 }
                 as = images
            }

        }
    }

}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-04-26 19:31:30

您可以简单地将这些dataProcessors堆在另一个内部,以实现您想要的结果如下:

代码语言:javascript
运行
复制
tt_content{
    contentslider < lib.fluidContent
    contentslider{
        templateName = CooperationsSlider
        dataProcessing {
            10 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
            10 {
                if.isTrue.field = tx_repeater_cooperationsslider
                table = tx_repeater_cooperationsslider
                pidInList.field = pid
                where = parentid=###uid### AND deleted=0 AND hidden=0 AND 1=1
                orderBy = sorting
                markers {
                    uid.field = uid
                }
                as = data_tx_repeater_cooperationsslider
                dataProcessing{
                    10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
                    10 {
                        references {
                            table = tx_repeater_cooperationsslider
                            fieldName = tx_repeater_image
                        }
                        as = images
                    }
                }
            }
        }
    }
}

您可以通过:{data.data_tx_repeater_cooperationsslider.images}在模板中访问此内容。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43589292

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档