0

我在 TYPO3 7.6 中使用中继器字段制作了自己的 CE。我可以保存图像一切正常 - 但我无法在我的流体模板中获取它们?我假设我必须以某种方式嵌套 DatabaseQueryProcessor 和 FilesProcessor?但我不知道怎么做?

ext_tables.sql

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/覆盖/tt_content.php

$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;

配置/TCA/tx_repeater_cooperationsslider.php

<?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']
            ),
        ),

  ),
);

打字稿

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
            }

        }
    }

}
4

1 回答 1

1

您可以简单地将这些数据处理器堆叠在另一个内部以实现您想要的效果:

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}

于 2017-04-26T19:31:30.860 回答