Bug #84692 » BUGFIX_Add_configuration_key__table__for_record_link_building_in_FE.patch

Marc Bastian Heinrichs, 2018-04-11 15:50

View differences:

typo3/sysext/frontend/Classes/Typolink/DatabaseRecordLinkBuilder.php (revision )
29 29
    public function build(array &$linkDetails, string $linkText, string $target, array $conf): array
30 30
    {
31 31
        $tsfe = $this->getTypoScriptFrontendController();
32
        $pageTsConfig = $tsfe->getPagesTSconfig();
33 32
        $configurationKey = $linkDetails['identifier'] . '.';
34 33
        $configuration = $tsfe->tmpl->setup['config.']['recordLinks.'];
35
        $linkHandlerConfiguration = $pageTsConfig['TCEMAIN.']['linkHandler.'];
36 34

  
37
        if (!isset($configuration[$configurationKey]) || !isset($linkHandlerConfiguration[$configurationKey])) {
35
        if (!isset($configuration[$configurationKey])) {
38 36
            throw new UnableToLinkException(
39 37
                'Configuration how to link "' . $linkDetails['typoLinkParameter'] . '" was not found, so "' . $linkText . '" was not linked.',
40 38
                1490989149,
......
43 41
            );
44 42
        }
45 43
        $typoScriptConfiguration = $configuration[$configurationKey]['typolink.'];
46
        $linkHandlerConfiguration = $linkHandlerConfiguration[$configurationKey]['configuration.'];
47 44

  
48 45
        if ($configuration[$configurationKey]['forceLink']) {
49
            $record = $tsfe->sys_page->getRawRecord($linkHandlerConfiguration['table'], $linkDetails['uid']);
46
            $record = $tsfe->sys_page->getRawRecord($configuration[$configurationKey]['table'], $linkDetails['uid']);
50 47
        } else {
51
            $record = $tsfe->sys_page->checkRecord($linkHandlerConfiguration['table'], $linkDetails['uid']);
48
            $record = $tsfe->sys_page->checkRecord($configuration[$configurationKey]['table'], $linkDetails['uid']);
52 49
        }
53 50
        if ($record === 0) {
54 51
            throw new UnableToLinkException(
......
61 58

  
62 59
        // Build the full link to the record
63 60
        $localContentObjectRenderer = GeneralUtility::makeInstance(ContentObjectRenderer::class);
64
        $localContentObjectRenderer->start($record, $linkHandlerConfiguration['table']);
61
        $localContentObjectRenderer->start($record, $configuration[$configurationKey]['table']);
65 62
        $localContentObjectRenderer->parameters = $this->contentObjectRenderer->parameters;
66 63
        $link = $localContentObjectRenderer->typoLink($linkText, $typoScriptConfiguration);
67 64

  
(1-1/2)