2017-03-06 4 views
0

"미디어"필드가있는 사용자 정의 컨텐츠 요소를 만들었습니다. 모든 필드는 "미디어 필드가"느릅 나무는 하늘의 배열이다 기대에 대한TYPO3 : 데이터 처리에서 사용자 정의 CE의 파일/미디어 가져 오기

class CustomCeProcessor implements DataProcessorInterface 
{ 

    /** 
    * Process data for the content element "My new content element" 
    * 
    * @param ContentObjectRenderer $cObj The data of the content element or page 
    * @param array $contentObjectConfiguration The configuration of Content Object 
    * @param array $processorConfiguration The configuration of this processor 
    * @param array $processedData Key/value store of processed data (e.g. to be passed to a Fluid View) 
    * @return array the processed data as key/value store 
    */ 
    public function process(
     ContentObjectRenderer $cObj, 
     array $contentObjectConfiguration, 
     array $processorConfiguration, 
     array $processedData 
    ) 
    { 
     $processedData['foo'] = 'This variable will be passed to Fluid'; 
     return $processedData; 
    } 
} 

$ processedData이 값을 포함

여기 내 데이터 프로세서 클래스입니다.

$GLOBALS['TCA']['tt_content']['types']['custom_ce'] = [ 
    'showitem'   => ' 
      --palette--;' . $frontendLanguageFilePrefix . 'palette.general;general, 
      --linebreak--, header;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:header_formlabel, 
      --linebreak--, date;Datum, 
      --linebreak--, media;Media, 
      --linebreak--, bodytext;txt, 
    ' 
]; 

가 어떻게 유체에 전달하기 위해 DataProcess의 미디어 파일에 액세스 할 수 있습니다 : 여기

내 TCA의 모습을 어떻게?

+0

이 지시 사항을 따르셨습니까? 아니요면, 그것을 보시기 바랍니다 : https://usetypo3.com/custom-fsc-element.html –

+0

예이 자습서를 사용하여 사용자 정의 양식을 작성했습니다. tt_content 테이블에 대한 internal_type "file"의 사용자 정의 "my_pdf"필드를 추가했습니다. 내 setup.txt에서 나는 튜토리얼 에서처럼 FilesProcessor에 대한 references.fieldName = my_pdf를 설정했다. 그러나 $ processedData [ 'files']는 CustomCeProcessor 클래스에서 비어 있습니다. – user6800816

답변

1

TYPO3\CMS\Frontend\DataProcessing\FilesProcessor도 가능합니다. 자체 DataProcessor를 작성하는 것은 필수적인 것은 아닙니다.

디버그 뷰 헬퍼를 활성화하면 파일이 my_pdf으로 표시됩니다.

파일이 Fluid debug viewhelper로 표시되는지 확인하십시오.