• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Yoast / Yoast-SEO-for-TYPO3 / 13327579701

14 Feb 2025 10:43AM UTC coverage: 1.276%. First build
13327579701

push

github

web-flow
Merge pull request #597 from Yoast/feature/v11

[FEATURE] Release 11.0.0

21 of 894 new or added lines in 76 files covered. (2.35%)

35 of 2744 relevant lines covered (1.28%)

0.04 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/Classes/Form/Element/InternalLinkingSuggestion.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace YoastSeoForTypo3\YoastSeo\Form\Element;
6

7
use TYPO3\CMS\Backend\Form\AbstractNode;
8
use TYPO3\CMS\Backend\Routing\UriBuilder;
9
use TYPO3\CMS\Core\Utility\GeneralUtility;
10
use YoastSeoForTypo3\YoastSeo\Service\Form\NodeTemplateService;
11
use YoastSeoForTypo3\YoastSeo\Service\Javascript\JavascriptService;
12
use YoastSeoForTypo3\YoastSeo\Service\Javascript\JsonConfigService;
13
use YoastSeoForTypo3\YoastSeo\Service\LocaleService;
14
use YoastSeoForTypo3\YoastSeo\Utility\PathUtility;
15

16
class InternalLinkingSuggestion extends AbstractNode
17
{
18
    // TODO: Use constructor DI when TYPO3 v11 can be dropped
19
    protected LocaleService $localeService;
20
    protected NodeTemplateService $templateService;
21
    protected JsonConfigService $jsonConfigService;
22
    protected JavascriptService $javascriptService;
23
    protected UriBuilder $uriBuilder;
24

25
    protected int $languageId;
26
    protected int $currentPage;
27

28
    /**
29
     * @return array<string, mixed>
30
     */
31
    public function render(): array
32
    {
33
        $this->init();
×
34

NEW
35
        $resultArray = $this->initializeResultArray();
×
36

NEW
37
        if (($locale = $this->localeService->getLocale($this->currentPage, $this->languageId)) === null) {
×
NEW
38
            $resultArray['html'] = $this->templateService->renderView('InternalLinkingSuggestion', ['languageError' => true]);
×
39
            return $resultArray;
×
40
        }
41
        $resultArray['stylesheetFiles'][] = 'EXT:yoast_seo/Resources/Public/CSS/yoast.min.css';
×
42

NEW
43
        $this->jsonConfigService->addConfig([
×
44
            'isCornerstoneContent' => false,
×
45
            'focusKeyphrase' => [
×
46
                'keyword' => '',
×
47
                'synonyms' => '',
×
48
            ],
×
49
            'data' => [
×
50
                'languageId' => $this->languageId,
×
51
            ],
×
52
            'linkingSuggestions' => [
×
53
                'excludedPage' => $this->currentPage,
×
54
                'locale' => $locale,
×
55
            ],
×
56
            'urls' => [
×
NEW
57
                'workerUrl' => PathUtility::getPublicPathToResources() . '/JavaScript/dist/worker.js',
×
NEW
58
                'linkingSuggestions' => (string)$this->uriBuilder
×
59
                    ->buildUriFromRoute('ajax_yoast_internal_linking_suggestions'),
×
60
            ],
×
NEW
61
            'translations' => [$this->localeService->getTranslations()],
×
NEW
62
            'supportedLanguages' => $this->localeService->getSupportedLanguages(),
×
NEW
63
        ]);
×
64

NEW
65
        $this->javascriptService->loadPluginJavascript();
×
66

NEW
67
        $resultArray['html'] = $this->templateService->renderView('InternalLinkingSuggestion');
×
68

69
        return $resultArray;
×
70
    }
71

72
    protected function init(): void
73
    {
NEW
74
        $this->localeService = GeneralUtility::makeInstance(LocaleService::class);
×
NEW
75
        $this->templateService = GeneralUtility::makeInstance(NodeTemplateService::class);
×
NEW
76
        $this->jsonConfigService = GeneralUtility::makeInstance(JsonConfigService::class);
×
NEW
77
        $this->javascriptService = GeneralUtility::makeInstance(JavascriptService::class);
×
NEW
78
        $this->uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
×
79

NEW
80
        $this->currentPage = $this->data['parentPageRow']['uid'];
×
NEW
81
        $this->languageId = $this->localeService->getLanguageIdFromData($this->data);
×
82
    }
83
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc