forked from FluidTYPO3/fluidpages
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEATURE] Replace deprecated configuration translation
Since TYPO3 7.6 the previous handling of translated page configuration has been deprecated and moved into the compatibility6 extension. To replace this functionality this commit introduces the flexform fields for configuration to the pages_language_overlay table and takes care of the overlaying of the affected configurations. This functionality is disable by default and can be activated through a toggle in the extension configuration. related deprecation: #70138 - Flex form language handling
- Loading branch information
Marc Neuhaus
committed
Dec 14, 2015
1 parent
e5e0614
commit 271f09b
Showing
8 changed files
with
189 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
namespace FluidTYPO3\Fluidpages\Provider; | ||
|
||
/* | ||
* This file is part of the FluidTYPO3/Fluidpages project under GPLv2 or later. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE.md file that was distributed with this source code. | ||
*/ | ||
|
||
use FluidTYPO3\Flux\Form; | ||
use FluidTYPO3\Flux\Provider\ProviderInterface; | ||
use TYPO3\CMS\Extbase\Reflection\ObjectAccess; | ||
|
||
/** | ||
* Page LanguageOverlayConfiguration Provider | ||
* | ||
* This Provider takes care of page Configuration | ||
* for other languages inside the pages_language_overlay | ||
* record. | ||
*/ | ||
class PageLanguageOverlayProvider extends PageProvider implements ProviderInterface { | ||
|
||
/** | ||
* @var string | ||
*/ | ||
protected $tableName = 'pages_language_overlay'; | ||
|
||
/** | ||
* @param array $record | ||
* @return array | ||
*/ | ||
protected function loadRecordTreeFromDatabase($record) { | ||
$parentFieldName = $this->getParentFieldName($record); | ||
if (FALSE === isset($record[$parentFieldName])) { | ||
$record[$parentFieldName] = $this->getParentFieldValue($record); | ||
} | ||
$pageRecord = $this->recordService->getSingle('pages', '*', $record['pid']); | ||
$records = array(); | ||
while (0 < $pageRecord[$parentFieldName]) { | ||
$record = $this->recordService->get($this->tableName, '*', 'pid = ' . $pageRecord['pid']); | ||
$parentFieldName = $this->getParentFieldName($record); | ||
array_push($records, $record); | ||
$pageRecord = $this->recordService->getSingle('pages', '*', $pageRecord['pid']); | ||
} | ||
$records = array_reverse($records); | ||
return $records; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
namespace FluidTYPO3\Fluidpages\Provider; | ||
|
||
/* | ||
* This file is part of the FluidTYPO3/Fluidpages project under GPLv2 or later. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE.md file that was distributed with this source code. | ||
*/ | ||
|
||
use FluidTYPO3\Flux\Form; | ||
use FluidTYPO3\Flux\Provider\ProviderInterface; | ||
|
||
/** | ||
* PageLanguageOverlay SubConfiguration Provider | ||
* | ||
* This Provider has a slightly lower priority | ||
* than the main PageProvider but will trigger | ||
* on any selection in the targeted field, | ||
* including when "parent decides" is selected. | ||
* | ||
* This lets the PageProvider act on records | ||
* that define a specific action to use and the | ||
* SubPageProvider act on all other page records. | ||
*/ | ||
class SubPageLanguageOverlayProvider extends PageLanguageOverlayProvider implements ProviderInterface { | ||
|
||
/** | ||
* @var string | ||
*/ | ||
protected $fieldName = self::FIELD_NAME_SUB; | ||
|
||
/** | ||
* @param array $row | ||
* @return string | ||
*/ | ||
public function getControllerActionReferenceFromRecord(array $row) { | ||
if (TRUE === empty($row[self::FIELD_ACTION_SUB])) { | ||
$row = $this->pageService->getPageTemplateConfiguration($row['uid']); | ||
} | ||
return $row[self::FIELD_ACTION_SUB]; | ||
} | ||
|
||
/** | ||
* @param array $row | ||
* @return array | ||
*/ | ||
public function getFlexFormValuesSingle(array $row) { | ||
$fieldName = $this->getFieldName($row); | ||
$form = $this->getForm($row); | ||
$immediateConfiguration = $this->configurationService->convertFlexFormContentToArray($row[$fieldName], $form, NULL, NULL); | ||
return $immediateConfiguration; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters