Typo3 FAL文件上载字段挂钩中的文件uid
我扩展了ExtendedFileUtilityProcessDataHookInterface,并为FAL文件上载字段创建了一个钩子Typo3 FAL文件上载字段挂钩中的文件uid,typo3,extbase,typo3-6.2.x,Typo3,Extbase,Typo3 6.2.x,我扩展了ExtendedFileUtilityProcessDataHookInterface,并为FAL文件上载字段创建了一个钩子 class tx_bibusdocuments_fileUploadHook implements TYPO3\CMS\Core\Utility\File\ExtendedFileUtilityProcessDataHookInterface { public function processData_postProcessAction($action, arr
class tx_bibusdocuments_fileUploadHook implements TYPO3\CMS\Core\Utility\File\ExtendedFileUtilityProcessDataHookInterface {
public function processData_postProcessAction($action, array $cmdArr, array $result, \TYPO3\CMS\Core\Utility\File\ExtendedFileUtility $parentObject){}
}
当我打印“$result”数组时,我得到了这样一个数组
Array
(
[0] => Array
(
[0] => TYPO3\CMS\Core\Resource\File Object
(
[metaDataLoaded:protected] =>
[metaDataProperties:protected] => Array
(
)
[indexingInProgress:protected] =>
[updatedProperties:protected] => Array
(
)
[indexerService:protected] =>
[properties:protected] => Array
(
[size] => 198218
[modification_date] => 1408449118
[creation_date] => 1408449118
[mime_type] => application/pdf
[name] => HomeTest.pdf
[identifier] => /user_upload/test.pdf
[identifier_hash] => 2bc8d0c4ed9f8a87fb9913af5dcd3977e0102027
[storage] => 1
[folder_hash] => e32a309fabc28dd85f053b65c5bd0da99860eb02
[type] => 5
[sha1] => 8a46595222d30c9cb4bcc48a4901d3e0f05e25ad
[extension] => pdf
[missing] => 0
[uid] => 139856
)
)
)
)
如何从这个$result数组中获取uid和文件名?我们可以这样迭代结果数组
public function processData_postProcessAction($action, array $cmdArr, array $result, \TYPO3\CMS\Core\Utility\File\ExtendedFileUtility $parentObject){
$files = array_pop( $result );
if ( !is_array( $files ) ) {
return;
}
foreach ( $files as $file ) {
$fileUid .= $file->getUid(); // Uid of the file
$fileName .= $file->getName(); // Name of the file
}
}