[BUGFIX] Do workspace overlay for not translated file meta data
[Packages/TYPO3.CMS.git] / typo3 / sysext / frontend / Classes / Aspect / FileMetadataOverlayAspect.php
1 <?php
2 namespace TYPO3\CMS\Frontend\Aspect;
3
4 /**
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 /**
18 * Class FileMetadataTranslationAspect
19 *
20 * We do not have AOP in TYPO3 for now, thus the aspect which
21 * deals with metadata translation is a slot which reacts on a signal
22 * in the Index\MetadataRepository.
23 *
24 * The aspect injects user permissions and mount points into the storage
25 * based on user or group configuration.
26 */
27 class FileMetadataOverlayAspect {
28
29 /**
30 * Do translation and workspace overlay
31 *
32 * @param \ArrayObject $data
33 * @return void
34 */
35 public function languageAndWorkspaceOverlay(\ArrayObject $data) {
36 $overlaidMetaData = $data->getArrayCopy();
37 $this->getTsfe()->sys_page->versionOL('sys_file_metadata', $overlaidMetaData);
38 $overlaidMetaData = $this->getTsfe()->sys_page->getRecordOverlay(
39 'sys_file_metadata',
40 $overlaidMetaData,
41 $this->getTsfe()->sys_language_content,
42 $this->getTsfe()->sys_language_contentOL
43 );
44 if ($overlaidMetaData !== NULL) {
45 $data->exchangeArray($overlaidMetaData);
46 }
47 }
48
49 /**
50 * @return \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController
51 */
52 protected function getTsfe() {
53 return $GLOBALS['TSFE'];
54 }
55 }