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

tomasnorre / crawler / 11237471329

08 Oct 2024 02:20PM UTC coverage: 68.586% (-1.3%) from 69.862%
11237471329

push

github

web-flow
ci: Update coveralls workflow (#1109)

1834 of 2674 relevant lines covered (68.59%)

3.37 hits per line

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

10.53
/Classes/ContextMenu/ItemProvider.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace AOE\Crawler\ContextMenu;
6

7
/*
8
 * (c) 2020 AOE GmbH <dev@aoe.com>
9
 *
10
 * This file is part of the TYPO3 Crawler Extension.
11
 *
12
 * It is free software; you can redistribute it and/or modify it under
13
 * the terms of the GNU General Public License, either version 2
14
 * of the License, or any later version.
15
 *
16
 * For the full copyright and license information, please read the
17
 * LICENSE.txt file that was distributed with this source code.
18
 *
19
 * The TYPO3 project - inspiring people to share!
20
 */
21

22
use AOE\Crawler\Domain\Repository\ConfigurationRepository;
23
use TYPO3\CMS\Backend\ContextMenu\ItemProviders\AbstractProvider;
24
use TYPO3\CMS\Backend\Utility\BackendUtility;
25
use TYPO3\CMS\Core\Utility\GeneralUtility;
26

27
/**
28
 * Provides a ContextMenu item
29
 * @internal since v9.2.5
30
 */
31
class ItemProvider extends AbstractProvider
32
{
33
    /**
34
     * @var array
35
     */
36
    protected $itemsConfiguration = [
37
        'crawler' => [
38
            'type' => 'item',
39
            'label' => 'LLL:EXT:crawler/Resources/Private/Language/Backend.xlf:contextMenu.label',
40
            'iconIdentifier' => 'tx-crawler',
41
            'callbackAction' => 'crawler',
42
        ],
43
    ];
44

45
    /**
46
     * Item is added only for crawler configurations
47
     */
48
    public function canHandle(): bool
49
    {
50
        return $this->table === ConfigurationRepository::TABLE_NAME;
2✔
51
    }
52

53
    /**
54
     * This needs to be lower than priority of the RecordProvider
55
     */
56
    public function getPriority(): int
57
    {
58
        return 50;
1✔
59
    }
60

61
    /**
62
     * Adds the crawler info
63
     */
64
    public function addItems(array $items): array
65
    {
66
        $localItems = $this->prepareItems($this->itemsConfiguration);
×
67
        return $items + $localItems;
×
68
    }
69

70
    protected function getAdditionalAttributes(string $itemName): array
71
    {
72
        $crawlerConfiguration = BackendUtility::getRecordWSOL($this->table, (int) $this->identifier);
×
73
        if ($crawlerConfiguration === null) {
×
74
            return [];
×
75
        }
76

77
        if (!array_key_exists('name', $crawlerConfiguration)) {
×
78
            $crawlerConfiguration['name'] = 'No Name found in configuration';
×
79
        }
80

81
        $additionalParameters = [];
×
82
        $additionalParameters[] = 'SET[function]=AOE\Crawler\Backend\BackendModule';
×
83
        $additionalParameters[] = 'SET[crawlaction]=start';
×
84
        $additionalParameters[] = 'configurationSelection[]=' . $crawlerConfiguration['name'];
×
85
        return [
×
86
            'data-dispatch-action' => 'TYPO3.ModuleMenu.showModule',
×
87
            'data-dispatch-args-list' => 'web_site_crawler_start,&' . GeneralUtility::quoteJSvalue(
×
88
                '&' . implode('&', $additionalParameters)
×
89
            ),
×
90
        ];
×
91
    }
92
}
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