Skip to content

Commit

Permalink
[DOCS] Fix examples of AfterPageTreeItemsPreparedEvent
Browse files Browse the repository at this point in the history
Resolves TYPO3-Documentation/Changelog-To-Doc#1175

Releases: main, 13.4, 12.4
  • Loading branch information
linawolf authored and github-actions[bot] committed Jan 11, 2025
1 parent 04cbd18 commit a4a7df9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class after the page tree items have been resolved and prepared. The event
provides the current PSR-7 request object as well as the page tree items. All
items contain the corresponding page record in the special :php:`_page` key.

.. _AfterPageTreeItemsPreparedEvent-labels:

Labels
======
Expand All @@ -37,6 +38,7 @@ A label can also be assigned to a node via
only the marker for the label with the highest priority is rendered. All
additional labels will only be added to the title of the node.

.. _AfterPageTreeItemsPreparedEvent-status:

Status information
==================
Expand All @@ -53,6 +55,7 @@ accessibility.
Each node can accommodate multiple status information, prioritized by severity
and urgency. Critical messages take precedence over other status notifications.

.. _AfterPageTreeItemsPreparedEvent-example:

Example
=======
Expand All @@ -63,6 +66,8 @@ Example

.. include:: /_includes/EventsAttributeAdded.rst.txt

.. _AfterPageTreeItemsPreparedEvent-api:

API
===

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function __invoke(AfterPageTreeItemsPreparedEvent $event): void
{
$items = $event->getItems();
foreach ($items as &$item) {
if ($item['_page']['uid'] === 123) {
if (($item['_page']['pid'] ?? null) === 123) {
// Set special icon for page with ID 123
$item['icon'] = 'my-special-icon';

Expand Down

0 comments on commit a4a7df9

Please sign in to comment.