georgringer / news_filter

Filter news
Other
4 stars 12 forks source link

Flexform hook removes settings from EXT:eventnews #2

Closed dmitryd closed 2 years ago

dmitryd commented 4 years ago

There is a problem if both EXT:eventnews and EXT:news_filter are used together: both override $dataStructArray['sheets']['extraEntry'], so only one of them will show up. Code from EXT:news_filter/Classes/Hooks/FlexFormHook.php:

    public function parseDataStructureByIdentifierPostProcess(array $dataStructure, array $identifier): array
    {
        if ($identifier['type'] === 'tca' && $identifier['tableName'] === 'tt_content' && $identifier['dataStructureKey'] === 'news_pi1,list') {
            $file = PATH_site . self::PATH;
            $content = file_get_contents($file);
            if ($content) {
                $dataStructure['sheets']['extraEntry'] = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($content);
            }
        }
        return $dataStructure;
    }

In my case eventnews are already executed and $dataStructure['sheets']['extraEntry'] contains:

s01

After the hook it contains:

s02