Skip to content

Commit 4b4c59e

Browse files
committed
Merge branch 'release/12.5.7'
2 parents 9a286fd + 8ca8c69 commit 4b4c59e

File tree

13 files changed

+352
-30
lines changed

13 files changed

+352
-30
lines changed

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
# In2publish Core Change Log
22

3+
12.5.7
4+
5+
- [META] Set the EM conf version number to 12.5.7
6+
- [BUGFIX] respect unchanged redirect
7+
- [CODESTYLE] Fix Codestyle
8+
- [FEATURE] Add Reasons Modal to Redirects
9+
- [FEATURE] Add event for filtering redirects in redirects module
10+
- [FEATURE] Add event for editing module template
11+
312
12.5.6:
13+
14+
- [META] Set the EM conf version number to 12.5.6
415
- [TEST] Adjust PublishChangedContentTest
516
- [BUGFIX] Fix publishbackgroundall dependency index
617
- [BUGFIX] Fix DirtyProperties of Redirect
@@ -9,18 +20,23 @@
920
- [BUGFIX] Implement suggested bugfix for duplicate key exception
1021

1122
12.5.5:
23+
24+
- [META] Set the EM conf version number to 12.5.5
1225
- [BUGFIX] Correct Response of Compare Tool
1326
- [BUGFIX] Make ResolverService public
1427
- [BUGFIX] Fix cache clear task
1528
- [BUGFIX] Fix filters in file module
1629
- [TASK] Make search in file module case-insensitive
1730

1831
12.5.4:
32+
33+
- [META] Set the EM conf version number to 12.5.4
1934
- [BUGFIX] Enable Logging in Command on foreign
2035
- [BUGFIX] LogLevel is evaluated correctly
2136

2237
12.5.3:
2338

39+
- [META] Set the EM conf version number to 12.5.3
2440
- [CODESTYLE] Make qa happy
2541
- [BUGFIX] Add make target for installing qa tools
2642
- [FEATURE] Adds Support for MM-Records to excluded Tables
@@ -43,13 +59,15 @@
4359

4460
12.5.2:
4561

62+
- [META] Set the EM conf version number to 12.5.2
4663
- [DOCS] Add known issue to explain missing (orphaned) MM records in the record tree
4764
- [BUGFIX] Discard the table portion of a joined row if the joined record does not exist
4865
- [META] Exclude compile-sass from archive
4966
- [BUGFIX] Cast pageuid to integer to build the preview URL
5067

5168
12.5.1:
5269

70+
- [META] Set the EM conf version number to 12.5.1
5371
- [BUGFIX] Correct evaluation of publishing state
5472
- [BUGFIX] Fixes Databender for Redirects
5573

Classes/Component/Core/Repository/SingleDatabaseRepository.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,10 @@ public function findByPropertyWithJoin(
148148
$splitRow['mmtbl']['uid_local'],
149149
$splitRow['mmtbl']['uid_foreign'],
150150
];
151-
if(isset($splitRow['mmtbl']['tablenames']))
152-
{
151+
if (isset($splitRow['mmtbl']['tablenames'])) {
153152
$mmIdentityProperties[] = $splitRow['mmtbl']['tablenames'];
154153
}
155-
if(isset($splitRow['mmtbl']['fieldname']))
156-
{
154+
if (isset($splitRow['mmtbl']['fieldname'])) {
157155
$mmIdentityProperties[] = $splitRow['mmtbl']['fieldname'];
158156
}
159157
$splitRows[hash('sha1', json_encode($mmIdentityProperties, JSON_THROW_ON_ERROR))] = $splitRow;

Classes/Controller/Traits/ControllerModuleTemplate.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131

3232
use In2code\In2publishCore\Backend\Button\ModuleShortcutButton;
3333
use In2code\In2publishCore\CommonInjection\ModuleTemplateFactoryInjection;
34+
use In2code\In2publishCore\Event\ModuleTemplateWasPreparedForRendering;
35+
use Psr\EventDispatcher\EventDispatcherInterface;
3436
use Psr\Http\Message\ResponseInterface;
3537
use Psr\Http\Message\ServerRequestInterface;
3638
use TYPO3\CMS\Backend\Template\ModuleTemplate;
@@ -43,6 +45,8 @@
4345

4446
/**
4547
* @property Request $request
48+
* @property EventDispatcherInterface $eventDispatcher
49+
* @property string $actionMethodName
4650
*/
4751
trait ControllerModuleTemplate
4852
{
@@ -84,6 +88,14 @@ protected function render(): string
8488
$buttonBar->addButton($moduleShortcutButton);
8589

8690
$this->moduleTemplate->setContent($this->view->render());
91+
92+
$event = new ModuleTemplateWasPreparedForRendering(
93+
$this->moduleTemplate,
94+
static::class,
95+
$this->actionMethodName
96+
);
97+
$this->eventDispatcher->dispatch($event);
98+
8799
return $this->moduleTemplate->renderContent();
88100
}
89101
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/*
6+
* Copyright notice
7+
*
8+
* (c) 2024 in2code.de and the following authors:
9+
* Daniel Hoffmann <[email protected]>
10+
*
11+
* All rights reserved
12+
*
13+
* This script is part of the TYPO3 project. The TYPO3 project is
14+
* free software; you can redistribute it and/or modify
15+
* it under the terms of the GNU General Public License as published by
16+
* the Free Software Foundation; either version 3 of the License, or
17+
* (at your option) any later version.
18+
*
19+
* The GNU General Public License can be found at
20+
* http://www.gnu.org/copyleft/gpl.html.
21+
*
22+
* This script is distributed in the hope that it will be useful,
23+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
24+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25+
* GNU General Public License for more details.
26+
*
27+
* This copyright notice MUST APPEAR in all copies of the script!
28+
*/
29+
30+
namespace In2code\In2publishCore\Event;
31+
32+
use TYPO3\CMS\Backend\Template\ModuleTemplate;
33+
34+
final class ModuleTemplateWasPreparedForRendering
35+
{
36+
private ModuleTemplate $moduleTemplate;
37+
private string $controllerClass;
38+
private string $actionMethodName;
39+
40+
public function __construct(
41+
ModuleTemplate $moduleTemplate,
42+
string $controllerClass,
43+
string $actionMethodName
44+
) {
45+
$this->moduleTemplate = $moduleTemplate;
46+
$this->controllerClass = $controllerClass;
47+
$this->actionMethodName = $actionMethodName;
48+
}
49+
50+
public function getModuleTemplate(): ModuleTemplate
51+
{
52+
return $this->moduleTemplate;
53+
}
54+
55+
public function getControllerClass(): string
56+
{
57+
return $this->controllerClass;
58+
}
59+
60+
public function getActionMethodName(): string
61+
{
62+
return $this->actionMethodName;
63+
}
64+
}

Classes/Features/RedirectsSupport/Controller/RedirectController.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
use In2code\In2publishCore\Features\RedirectsSupport\Domain\Dto\Filter;
4747
use In2code\In2publishCore\Features\RedirectsSupport\Domain\Model\SysRedirectDatabaseRecord;
4848
use In2code\In2publishCore\Features\RedirectsSupport\Domain\Repository\SysRedirectRepository;
49+
use In2code\In2publishCore\Features\RedirectsSupport\Event\RedirectsWereFilteredForListing;
4950
use In2code\In2publishCore\Service\ForeignSiteFinderInjection;
5051
use Psr\Http\Message\ResponseInterface;
5152
use Throwable;
@@ -154,7 +155,11 @@ public function listAction(Filter $filter = null, int $page = 1): ResponseInterf
154155
$this->demandResolver->resolveDemand($demands, $recordCollection);
155156

156157
$redirects = $this->getRedirectsByStateFromFilter($recordTree, $filter);
157-
$paginator = new ArrayPaginator($redirects, $page, 15);
158+
159+
$event = new RedirectsWereFilteredForListing($redirects);
160+
$this->eventDispatcher->dispatch($event);
161+
162+
$paginator = new ArrayPaginator($event->getRedirects(), $page, 15);
158163
$pagination = new SimplePagination($paginator);
159164
$this->view->assignMultiple(
160165
[
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/*
6+
* Copyright notice
7+
*
8+
* (c) 2024 in2code.de and the following authors:
9+
* Daniel Hoffmann <[email protected]>
10+
*
11+
* All rights reserved
12+
*
13+
* This script is part of the TYPO3 project. The TYPO3 project is
14+
* free software; you can redistribute it and/or modify
15+
* it under the terms of the GNU General Public License as published by
16+
* the Free Software Foundation; either version 3 of the License, or
17+
* (at your option) any later version.
18+
*
19+
* The GNU General Public License can be found at
20+
* http://www.gnu.org/copyleft/gpl.html.
21+
*
22+
* This script is distributed in the hope that it will be useful,
23+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
24+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25+
* GNU General Public License for more details.
26+
*
27+
* This copyright notice MUST APPEAR in all copies of the script!
28+
*/
29+
30+
namespace In2code\In2publishCore\Features\RedirectsSupport\Event;
31+
32+
final class RedirectsWereFilteredForListing
33+
{
34+
private array $redirects;
35+
36+
public function __construct(array $redirects)
37+
{
38+
$this->redirects = $redirects;
39+
}
40+
41+
public function getRedirects(): array
42+
{
43+
return $this->redirects;
44+
}
45+
46+
public function setRedirects(array $redirects): void
47+
{
48+
$this->redirects = $redirects;
49+
}
50+
}
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace In2code\In2publishCore\Features\RedirectsSupport\ViewHelpers;
6+
7+
/*
8+
* Copyright notice
9+
*
10+
* (c) 2024 in2code.de
11+
* Daniel Hoffmann <[email protected]>
12+
*
13+
* All rights reserved
14+
*
15+
* This script is part of the TYPO3 project. The TYPO3 project is
16+
* free software; you can redistribute it and/or modify
17+
* it under the terms of the GNU General Public License as published by
18+
* the Free Software Foundation; either version 3 of the License, or
19+
* (at your option) any later version.
20+
*
21+
* The GNU General Public License can be found at
22+
* http://www.gnu.org/copyleft/gpl.html.
23+
*
24+
* This script is distributed in the hope that it will be useful,
25+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
26+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27+
* GNU General Public License for more details.
28+
*
29+
* This copyright notice MUST APPEAR in all copies of the script!
30+
*/
31+
32+
use In2code\In2publishCore\Features\RedirectsSupport\Domain\Model\SysRedirectDatabaseRecord;
33+
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
34+
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractTagBasedViewHelper;
35+
36+
class ShowReasonsButtonViewHelper extends AbstractTagBasedViewHelper
37+
{
38+
protected $tagName = 'a';
39+
40+
public function initializeArguments(): void
41+
{
42+
parent::initializeArguments();
43+
$this->registerUniversalTagAttributes();
44+
$this->registerArgument('redirectRecord', SysRedirectDatabaseRecord::class, '', true);
45+
}
46+
47+
public function render(): string
48+
{
49+
/**
50+
* @var $redirectRecord SysRedirectDatabaseRecord
51+
*/
52+
$redirectRecord = $this->arguments['redirectRecord'];
53+
$this->tag->addAttribute('href', '#');
54+
$this->tag->setContent($this->renderChildren());
55+
$modalConfiguration = [
56+
'settings' => [
57+
'title' => LocalizationUtility::translate('LLL:EXT:in2publish_core/Resources/Private/Language/locallang_mod5.xlf:modal.reasons.title'),
58+
'content' => implode("\r\n", $redirectRecord->getReasonsWhyTheRecordIsNotPublishableHumanReadable()),
59+
'severity' => 1,
60+
],
61+
'buttons' => [
62+
'abort' => [
63+
'text' => 'Abort',
64+
'btnClass' => 'btn btn-default',
65+
'name' => 'abort',
66+
'active' => true,
67+
],
68+
],
69+
];
70+
$this->tag->addAttribute('data-modal-configuration', json_encode($modalConfiguration));
71+
72+
return $this->tag->render();
73+
}
74+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# ModuleTemplateWasPreparedForRendering
2+
3+
## When
4+
5+
This event is fired each time a backend module is opened.
6+
7+
## What
8+
9+
* `moduleTemplate`: an object of type TYPO3\CMS\Backend\Template\ModuleTemplate
10+
* `controllerClass`: controller class calling the event
11+
* `actionMethodName`: action method name calling the event
12+
13+
## Possibilities
14+
15+
With this event you can add e.g. buttons to the docheader of a backend module.
16+
17+
### Example
18+
19+
This example shows you how to add a button to the docheader of the redirect module.
20+
21+
```php
22+
use In2code\In2publish\Features\ContentLanguageControl\Toolbar\LanguageSelectionButtonInjection;
23+
use In2code\In2publishCore\Event\ModuleTemplateWasPreparedForRendering;
24+
use In2code\In2publishCore\Features\RedirectsSupport\Controller\RedirectController;
25+
26+
class ModuleTemplateButtonBarSelectionRenderer
27+
{
28+
use LanguageSelectionButtonInjection;
29+
30+
public function whenModuleTemplateWasPreparedForRendering(ModuleTemplateWasPreparedForRendering $event): void
31+
{
32+
if (RedirectController::class === $event->getControllerClass() && 'listAction' === $event->getActionMethodName()){
33+
$moduleTemplate = $event->getModuleTemplate();
34+
$moduleTemplate->getDocHeaderComponent()->getButtonBar()->addButton($this->languageSelectionButton);
35+
}
36+
}
37+
}
38+
```

0 commit comments

Comments
 (0)