Skip to content

Commit

Permalink
[TASK] Trigger errors for old hook usages (#2575)
Browse files Browse the repository at this point in the history
  • Loading branch information
georgringer authored Nov 23, 2024
1 parent 98df1ed commit 9eba8a8
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Classes/Controller/NewsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ protected function createDemandObjectFromSettings(
));

if ($hooks = $GLOBALS['TYPO3_CONF_VARS']['EXT']['news']['Controller/NewsController.php']['createDemandObjectFromSettings'] ?? []) {
trigger_error('The hook $GLOBALS[\'TYPO3_CONF_VARS\'][\'EXT\'][\'news\'][\'Controller/NewsController.php\'][\'createDemandObjectFromSettings\'] has been deprecated, use event CreateDemandObjectFromSettingsEvent instead', E_USER_DEPRECATED);
$params = [
'demand' => $demand,
'settings' => $settings,
Expand Down Expand Up @@ -644,6 +645,7 @@ public function buildSettings(): void
}

foreach ($hooks = ($GLOBALS['TYPO3_CONF_VARS']['EXT']['news']['Controller/NewsController.php']['overrideSettings'] ?? []) as $_funcRef) {
trigger_error('The hook $GLOBALS[\'TYPO3_CONF_VARS\'][\'EXT\'][\'news\'][\'Controller/NewsController.php\'][\'overrideSettings\'] has been deprecated, use event NewsControllerOverrideSettingsEvent instead', E_USER_DEPRECATED);
$_params = [
'originalSettings' => $originalSettings,
'tsSettings' => $tsSettings,
Expand Down
1 change: 1 addition & 0 deletions Classes/Domain/Repository/AbstractDemandedRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ protected function generateQuery(DemandInterface $demand, $respectEnableFields =

// Call hook functions for additional constraints
if ($hooks = $GLOBALS['TYPO3_CONF_VARS']['EXT']['news']['Domain/Repository/AbstractDemandedRepository.php']['findDemanded'] ?? []) {
trigger_error('The hook $GLOBALS[\'TYPO3_CONF_VARS\'][\'EXT\'][\'news\'][\'Domain/Repository/AbstractDemandedRepository.php\'][\'findDemanded\'] has been deprecated. Use the ModifyDemandRepositoryEvent instead.', E_USER_DEPRECATED);
$params = [
'demand' => $demand,
'respectEnableFields' => &$respectEnableFields,
Expand Down
1 change: 1 addition & 0 deletions Classes/Hooks/PluginPreviewRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ public function renderPageModulePreviewContent(GridColumnItem $item): string

// @deprecated, use PluginPreviewRendererEvent instead
if ($hooks = $GLOBALS['TYPO3_CONF_VARS']['EXT']['news'][\GeorgRinger\News\Hooks\PluginPreviewRenderer::class]['extensionSummary'] ?? []) {
trigger_error('The hook $GLOBALS[\'TYPO3_CONF_VARS\'][\'EXT\'][\'news\'][\GeorgRinger\News\Hooks\PluginPreviewRenderer::class][\'extensionSummary\'] has been deprecated, use event PluginPreviewSummaryEvent instead', E_USER_DEPRECATED);
$params['item'] = $item;
foreach ($hooks as $reference) {
GeneralUtility::callUserFunction($reference, $params, $this);
Expand Down
73 changes: 73 additions & 0 deletions Documentation/Misc/Changelog/12-2-0.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
12.2.0 - XXth XXXXXXXX 2024
===========================

Regular release, please read the following notes carefully.

.. contents::
:local:
:depth: 3

Important changes
-----------------

Changed behavior for TS settings.search.paginate.itemsPerPage
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The TypoScript setting `settings.search.paginate.itemsPerPage` has been disabled in the default TypoScript setup.
This makes it possible that the setting provied in the plugin configuration (FlexForms) is used.
However, this uses the default backup of `settings.list.paginate.itemsPerPage`.

Deprecated hooks
~~~~~~~~~~~~~~~~

The following hooks have been deprecated and will be removed with the next major version:

- `$GLOBALS['TYPO3_CONF_VARS']['EXT']['news']['Domain/Repository/AbstractDemandedRepository.php']['findDemanded']`: use the event `\GeorgRinger\News\Event\ModifyDemandRepositoryEvent`
- `$GLOBALS['TYPO3_CONF_VARS']['EXT']['news']['Controller/NewsController.php']['overrideSettings']`: use the event `\GeorgRinger\News\Event\NewsControllerOverrideSettingsEvent`
- `$GLOBALS['TYPO3_CONF_VARS']['EXT']['news']['Controller/NewsController.php']['createDemandObjectFromSettings']`: use the event `\GeorgRinger\News\Event\CreateDemandObjectFromSettingsEvent`
- `$GLOBALS['TYPO3_CONF_VARS']['EXT']['news'][\GeorgRinger\News\Hooks\PluginPreviewRenderer::class]['extensionSummary']`: use the event `\GeorgRinger\News\Event\PluginPreviewSummaryEvent`

Calling any of the aforementioned hooks will trigger deprecation log entries.

Features
--------

New events
~~~~~~~~~~

Finally the last hooks of the extension are now available as event to follow the best practices of TYPO3 core.

The most used is `$GLOBALS['TYPO3_CONF_VARS']['EXT']['news']['Domain/Repository/AbstractDemandedRepository.php']['findDemanded']` which is used to modify the query to fetch the news records. This is now available as `\GeorgRinger\News\Event\ModifyDemandRepositoryEvent`.

See above for a full list of available events.



All Changes
-----------
This is a list of all changes in this release: ::

2024-11-23 [BUGFIX] Respect pagination itemsPerPage in search (Commit b7bb5547 by Georg Ringer)
2024-11-22 [DOC] Fix links to TSconfig (#2574) (Commit b9c5ae13 by Lina Wolf)
2024-11-22 [BUGFIX] fix proxy cache update required check in ClassCacheManager::reBuildSimple (#2570) (Commit 87bdbca2 by bahammes)
2024-11-22 [BUGFIX] Fix ExtensionLoaded VH #2572 (#2573) (Commit 1d16333c by Georg Ringer)
2024-11-22 [TASK] Add empty line (Commit f534ef92 by Georg Ringer)
2024-11-22 [FEATURE] Provide event NewsControllerOverrideSettingsEvent #2571 (Commit 44576967 by Georg Ringer)
2024-11-22 [FEATURE] Provide event CreateDemandObjectFromSettingsEvent #2567 (Commit c11b0155 by Georg Ringer)
2024-11-22 [TASK] Make csfixer happy (Commit 33cb657d by Georg Ringer)
2024-11-22 [FEATURE] Provide event ModifyDemandRepositoryEvent #2568 (Commit caf0de50 by Georg Ringer)
2024-11-20 [TASK] Rename event (Commit 01dfbdae by Georg Ringer)
2024-11-20 [FEATURE] Add event PluginPreviewSummaryEvent (Commit 362da131 by Georg Ringer)
2024-11-12 [TASK] Use direct callback function (speed improvement) (Commit dfdd02b5 by Simon Schaufelberger)
2024-11-12 [TASK] Use direct null comparison (Commit e751372c by Simon Schaufelberger)
2024-11-12 [TASK] Use brackets to clarify code execution (Commit 167bcc17 by Simon Schaufelberger)
2024-11-12 [TASK] Remove useless string concatenation (Commit 3f952201 by Simon Schaufelberger)
2024-11-12 [TASK] Use arrow function (Commit 1c936a9d by Simon Schaufelberger)
2024-11-12 [TASK] Remove casts as the method always return the expected type (Commit 0cbe3acb by Simon Schaufelberger)
2024-11-12 [TASK] Add non-breaking type annotations (Commit a3d10af0 by Simon Schaufelberger)
2024-11-12 [TASK] Improve doctype annotations (Commit 2cccd7be by Simon Schaufelberger)
2024-11-19 [TASK] Simplify TCA (Commit 6a418a68 by Georg Ringer)
2024-11-19 [DOC] Update readme (Commit 5aae7674 by Georg Ringer)
2024-11-18 [DOCS] Use page argument in routePath (Commit cff7ec14 by Simon Schaufelberger)
2024-11-17 [BUGFIX] Use distinct names for sets #2563 (Commit 625884a5 by Georg Ringer)

This list has been created by using `git log $(git describe --tags --abbrev=0)..HEAD --abbrev-commit --pretty='%ad %s (Commit %h by %an)' --date=short`.
1 change: 1 addition & 0 deletions Documentation/Misc/Changelog/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ List of versions
:titlesonly:
:glob:

12-2-0
12-1-0
12-0-0
11-4-3
Expand Down

0 comments on commit 9eba8a8

Please sign in to comment.