Skip to content

Commit

Permalink
[TASK] #98443 - Extension recordlist merged into backend (#2234)
Browse files Browse the repository at this point in the history
* [TASK] #98443 - Extension recordlist merged into backend

Related: TYPO3-Documentation/Changelog-To-Doc#191

* Adjust link handlers

* Adjust testing

* Remove recordlist from composer.json
  • Loading branch information
brotkrueml authored Sep 30, 2022
1 parent c32dbdc commit 28b63cd
Show file tree
Hide file tree
Showing 29 changed files with 370 additions and 324 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
.. include:: /Includes.rst.txt
.. index:: Events; ModifyAllowedItemsEvent
.. _ModifyAllowedItemsEvent:


=======================
ModifyAllowedItemsEvent
=======================

.. versionadded:: 12.0
This event has been introduced together with
:ref:`ModifyLinkHandlersEvent` to
serve as a direct replacement for the following removed hook:

* :php:`$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['LinkBrowser']['hooks']`

It replaces the method :php:`modifyAllowedItems()` in this hook.

The event allows extensions to add or remove from the list of allowed link
types.

.. seealso::

* :ref:`modifyLinkHandlers`
* :ref:`ModifyLinkHandlersEvent`

Example
=======

Registration of the event in your extension's :file:`Services.yaml`:

.. code-block:: yaml
:caption: EXT:my_extension/Configuration/Services.yaml
Vendor\MyExtension\Backend\MyEventListener:
tags:
- name: event.listener
identifier: 'my-extension/backend/allowed-items'
The corresponding event listener class:

.. code-block:: php
:caption: EXT:my_extension/Classes/Backend/MyEventListener.php
TYPO3\CMS\Backend\Controller\Event\ModifyAllowedItemsEvent;
final class MyEventListener
{
public function __invoke(ModifyAllowedItemsEvent $event): void
{
$event->addAllowedItem('someItem');
$event->removeAllowedItem('anotherItem');
}
}
API
===

.. include:: /CodeSnippets/Events/Backend/ModifyAllowedItemsEvent.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
.. include:: /Includes.rst.txt
.. index:: Events; ModifyLinkHandlersEvent
.. _ModifyLinkHandlersEvent:


=======================
ModifyLinkHandlersEvent
=======================

.. versionadded:: 12.0
This event has been introduced together with
:ref:`ModifyAllowedItemsEvent` to
serve as a direct replacement for the following removed hook:

* :php:`$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['LinkBrowser']['hooks']`

It replaces the method :php:`modifyLinkHandlers()` in this hook.

The event is triggered before link handlers are executed, allowing listeners
to modify the set of handlers that will be used.

.. seealso::
* :ref:`modifyLinkHandlers`
* :ref:`ModifyAllowedItemsEvent`

Example
=======

Registration of the event in your extension's :file:`Services.yaml`:

.. code-block:: yaml
:caption: EXT:my_extension/Configuration/Services.yaml
Vendor\MyExtension\Backend\MyEventListener:
tags:
- name: event.listener
identifier: 'my-extension/backend/link-handlers'
The corresponding event listener class:

.. code-block:: php
:caption: EXT:my_extension/Classes/Backend/MyEventListener.php
use TYPO3\CMS\Backend\Controller\Event\ModifyLinkHandlersEvent;
final class MyEventListener
{
public function __invoke(ModifyLinkHandlersEvent $event): void
{
$handler = $event->getHandler('url.');
$handler['label'] = 'My custom label';
$event->setHandler('url.', $handler);
}
}
API
===

.. include:: /CodeSnippets/Events/Backend/ModifyLinkHandlersEvent.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
.. include:: /Includes.rst.txt
.. index:: Events; ModifyRecordListHeaderColumnsEvent
.. _ModifyRecordListHeaderColumnsEvent:


==================================
ModifyRecordListHeaderColumnsEvent
==================================

.. versionadded:: 11.4

.. versionchanged:: 12.0
Due to the integration of EXT:recordlist into EXT:backend the namespace of
the event changed from
:php:`TYPO3\CMS\Recordlist\Event\ModifyRecordListHeaderColumnsEvent`
to
:php:`TYPO3\CMS\Backend\RecordList\Event\ModifyRecordListHeaderColumnsEvent`.
For TYPO3 v12 the moved class is available as an alias under the old
namespace to allow extensions to be compatible with TYPO3 v11 and v12.


An event to modify the header columns for a table in the record list.

Usage
=====

See :ref:`combined usage example <ModifyRecordListTableActionsEvent-usage>`.

API
===

.. include:: /CodeSnippets/Events/Backend/ModifyRecordListHeaderColumnsEvent.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
.. include:: /Includes.rst.txt
.. index:: Events; ModifyRecordListHeaderColumnsEvent
.. _ModifyRecordListRecordActionsEvent:


==================================
ModifyRecordListRecordActionsEvent
==================================

.. versionadded:: 11.4

.. versionchanged:: 12.0
Due to the integration of EXT:recordlist into EXT:backend the namespace of
the event changed from
:php:`TYPO3\CMS\Recordlist\Event\ModifyRecordListRecordActionsEvent`
to
:php:`TYPO3\CMS\Backend\RecordList\Event\ModifyRecordListRecordActionsEvent`.
For TYPO3 v12 the moved class is available as an alias under the old
namespace to allow extensions to be compatible with TYPO3 v11 and v12.

An event to modify the displayed record actions (for example
:guilabel:`edit`, :guilabel:`copy`, :guilabel:`delete`) for a table in
the record list.

Usage
=====

See :ref:`combined usage example <ModifyRecordListTableActionsEvent-usage>`.

API
===

.. include:: /CodeSnippets/Events/Backend/ModifyRecordListRecordActionsEvent.rst.txt
Original file line number Diff line number Diff line change
@@ -1,51 +1,55 @@
.. include:: /Includes.rst.txt
.. index:: Events; ModifyRecordListTableActionsEvent
.. _ModifyRecordListTableActionsEvent:
.. include:: /Includes.rst.txt
.. index:: Events; ModifyRecordListTableActionsEvent
.. _ModifyRecordListTableActionsEvent:


========================================
=================================
ModifyRecordListTableActionsEvent
========================================
=================================

.. versionadded:: 11.4
.. versionadded:: 11.4

.. versionchanged:: 12.0
Due to the integration of EXT:recordlist into EXT:backend the namespace of
the event changed from
:php:`TYPO3\CMS\Recordlist\Event\ModifyRecordListTableActionsEvent`
to
:php:`TYPO3\CMS\Backend\RecordList\Event\ModifyRecordListTableActionsEvent`.
For TYPO3 v12 the moved class is available as an alias under the old
namespace to allow extensions to be compatible with TYPO3 v11 and v12.

An event to modify the multi record selection actions (for example
:guilabel:`edit`, :guilabel:`copy to clipboard`) for a table in the record list.

API
---

.. include:: /CodeSnippets/Events/RecordList/ModifyRecordListTableActionsEvent.rst.txt

.. _ModifyRecordListTableActionsEvent-usage:
.. _ModifyRecordListTableActionsEvent-usage:

Usage
=====

An example registration of the events in your extensions' :file:`Services.yaml`:

.. code-block:: yaml
.. code-block:: yaml
MyVendor\MyPackage\RecordList\MyEventListener:
tags:
- name: event.listener
identifier: 'my-package/recordlist/my-event-listener'
method: 'modifyRecordActions'
- name: event.listener
identifier: 'my-package/recordlist/my-event-listener'
method: 'modifyHeaderColumns'
- name: event.listener
identifier: 'my-package/recordlist/my-event-listener'
method: 'modifyTableActions'
MyVendor\MyPackage\RecordList\MyEventListener:
tags:
- name: event.listener
identifier: 'my-package/recordlist/my-event-listener'
method: 'modifyRecordActions'
- name: event.listener
identifier: 'my-package/recordlist/my-event-listener'
method: 'modifyHeaderColumns'
- name: event.listener
identifier: 'my-package/recordlist/my-event-listener'
method: 'modifyTableActions'
The corresponding event listener class:

.. code-block:: php
.. code-block:: php
use Psr\Log\LoggerInterface;
use TYPO3\CMS\Recordlist\Event\ModifyRecordListHeaderColumnsEvent;
use TYPO3\CMS\Recordlist\Event\ModifyRecordListRecordActionsEvent;
use TYPO3\CMS\Recordlist\Event\ModifyRecordListTableActionsEvent;
use TYPO3\CMS\Backend\RecordList\Event\ModifyRecordListHeaderColumnsEvent;
use TYPO3\CMS\Backend\RecordList\Event\ModifyRecordListRecordActionsEvent;
use TYPO3\CMS\Backend\RecordList\Event\ModifyRecordListTableActionsEvent;
final class MyEventListener {
Expand Down Expand Up @@ -102,5 +106,9 @@ The corresponding event listener class:
// Set a custom label for the case, no actions are available for the user
$event->setNoActionLabel('No actions available due to missing permissions.');
}
}
API
===

.. include:: /CodeSnippets/Events/Backend/ModifyRecordListTableActionsEvent.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.. include:: /Includes.rst.txt
.. index:: Events; RenderAdditionalContentToRecordListEvent
.. _RenderAdditionalContentToRecordListEvent:


========================================
RenderAdditionalContentToRecordListEvent
========================================

.. versionadded:: 11.0

.. versionchanged:: 12.0
Due to the integration of EXT:recordlist into EXT:backend the namespace of
the event changed from
:php:`TYPO3\CMS\Recordlist\Event\RenderAdditionalContentToRecordListEvent`
to
:php:`TYPO3\CMS\Backend\Controller\Event\RenderAdditionalContentToRecordListEvent`.
For TYPO3 v12 the moved class is available as an alias under the old
namespace to allow extensions to be compatible with TYPO3 v11 and v12.

Event to add content before or after the main content of the list module.


API
---

.. include:: /CodeSnippets/Events/Backend/RenderAdditionalContentToRecordListEvent.rst.txt
19 changes: 0 additions & 19 deletions Documentation/ApiOverview/Events/Events/Recordlist/Index.rst

This file was deleted.

This file was deleted.

Loading

0 comments on commit 28b63cd

Please sign in to comment.