Skip to content

Product tour: Deptract+Rector fixes#3136

Merged
adriendupuis merged 4 commits intorelease-5.0.7from
release-5.0.7-integratedhelp-deptrac
Apr 14, 2026
Merged

Product tour: Deptract+Rector fixes#3136
adriendupuis merged 4 commits intorelease-5.0.7from
release-5.0.7-integratedhelp-deptrac

Conversation

@adriendupuis
Copy link
Copy Markdown
Contributor

@adriendupuis adriendupuis commented Apr 14, 2026

Question Answer
JIRA Ticket
Versions
Edition

Checklist

  • Text renders correctly
  • Text has been checked with vale
  • Description metadata is up to date
  • Redirects cover removed/moved pages
  • Code samples are working
  • PHP code samples have been fixed with PHP CS fixer
  • Added link to this PR in relevant JIRA ticket or code PR

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 14, 2026

Preview of modified files

Preview of modified Markdown:

Copy link
Copy Markdown
Contributor

@mnocon mnocon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@adriendupuis adriendupuis changed the title Product tour: deptrac.baseline.yaml update Product tour: Deptract+Rector fixes Apr 14, 2026
@github-actions
Copy link
Copy Markdown

code_samples/ change report

Before (on target branch)After (in current PR)

code_samples/back_office/product_tour/src/EventSubscriber/NotificationScenarioSubscriber.php


code_samples/back_office/product_tour/src/EventSubscriber/NotificationScenarioSubscriber.php

docs/administration/back_office/customize_product_tour.md@43:```php hl_lines="35-37 39-41 43-45 47-58"
docs/administration/back_office/customize_product_tour.md@43:```php hl_lines="32-34 36-38 40-42 44-55"
docs/administration/back_office/customize_product_tour.md@44:[[= include_file('code_samples/back_office/product_tour/src/EventSubscriber/NotificationScenarioSubscriber.php') =]]
docs/administration/back_office/customize_product_tour.md@45:```

001⫶<?php
002⫶
003⫶declare(strict_types=1);
004⫶
005⫶namespace App\EventSubscriber;
006⫶
007⫶use Ibexa\Contracts\Core\Repository\NotificationService;
008⫶use Ibexa\Contracts\IntegratedHelp\Event\RenderProductTourScenarioEvent;
009⫶use Ibexa\IntegratedHelp\ProductTour\Block\LinkBlock;
010⫶use Ibexa\IntegratedHelp\ProductTour\Block\TextBlock;
011⫶use Ibexa\IntegratedHelp\ProductTour\ProductTourStep;
012⫶use Symfony\Component\EventDispatcher\EventSubscriberInterface;
013⫶
docs/administration/back_office/customize_product_tour.md@44:[[= include_file('code_samples/back_office/product_tour/src/EventSubscriber/NotificationScenarioSubscriber.php') =]]
docs/administration/back_office/customize_product_tour.md@45:```

001⫶<?php
002⫶
003⫶declare(strict_types=1);
004⫶
005⫶namespace App\EventSubscriber;
006⫶
007⫶use Ibexa\Contracts\Core\Repository\NotificationService;
008⫶use Ibexa\Contracts\IntegratedHelp\Event\RenderProductTourScenarioEvent;
009⫶use Ibexa\IntegratedHelp\ProductTour\Block\LinkBlock;
010⫶use Ibexa\IntegratedHelp\ProductTour\Block\TextBlock;
011⫶use Ibexa\IntegratedHelp\ProductTour\ProductTourStep;
012⫶use Symfony\Component\EventDispatcher\EventSubscriberInterface;
013⫶
014⫶final class NotificationScenarioSubscriber implements EventSubscriberInterface
014⫶final readonly class NotificationScenarioSubscriber implements EventSubscriberInterface
015⫶{
015⫶{
016⫶    private NotificationService $notificationService;
017⫶
018⫶ public function __construct(NotificationService $notificationService)
019⫶ {
020⫶ $this->notificationService = $notificationService;
021⫶ }
022⫶
023⫶ public static function getSubscribedEvents(): array
024⫶ {
025⫶ return [
026⫶ RenderProductTourScenarioEvent::class => ['onRenderScenario'],
027⫶ ];
028⫶ }
029⫶
030⫶ public function onRenderScenario(RenderProductTourScenarioEvent $event): void
031⫶ {
032⫶ $scenario = $event->getScenario();
033⫶ $steps = $scenario->getSteps();
034⫶
035❇️ if ($scenario->getIdentifier() !== 'notifications') {
036❇️ return;
037❇️ }
038⫶
039❇️ foreach ($steps as $step) {
040❇️ $scenario->removeStep($step);
041❇️ }
042⫶
043❇️ if (!$this->hasUnreadNotifications()) {
044❇️ return;
045❇️ }
046⫶
047❇️ $customStep = new ProductTourStep();
048❇️ $customStep->setIdentifier('custom_step_identifier');
049❇️ $customStep->setInteractionMode('clickable');
050❇️ $customStep->setTarget('.ibexa-header-user-menu__notifications-toggler');
051❇️ $customStep->setTitle('You have unread notifications');
052❇️ $customStep->addBlock(new TextBlock('Click here to preview your unread notifications.'));
053❇️ $customStep->addBlock(new LinkBlock(
054❇️ 'https://doc.ibexa.co/projects/userguide/en/latest/getting_started/notifications/',
055❇️ 'Learn more about notifications'
056❇️ ));
057❇️
058❇️ $scenario->addStep($customStep);
059⫶ }
060⫶
061⫶ private function hasUnreadNotifications(): bool
062⫶ {
063⫶ return $this->notificationService->getPendingNotificationCount() > 0;
064⫶ }
065⫶}
016⫶    public function __construct(private NotificationService $notificationService)
017⫶ {
018⫶ }
019⫶
020⫶ public static function getSubscribedEvents(): array
021⫶ {
022⫶ return [
023⫶ RenderProductTourScenarioEvent::class => ['onRenderScenario'],
024⫶ ];
025⫶ }
026⫶
027⫶ public function onRenderScenario(RenderProductTourScenarioEvent $event): void
028⫶ {
029⫶ $scenario = $event->getScenario();
030⫶ $steps = $scenario->getSteps();
031⫶
032❇️ if ($scenario->getIdentifier() !== 'notifications') {
033❇️ return;
034❇️ }
035⫶
036❇️ foreach ($steps as $step) {
037❇️ $scenario->removeStep($step);
038❇️ }
039⫶
040❇️ if (!$this->hasUnreadNotifications()) {
041❇️ return;
042❇️ }
043⫶
044❇️ $customStep = new ProductTourStep();
045❇️ $customStep->setIdentifier('custom_step_identifier');
046❇️ $customStep->setInteractionMode('clickable');
047❇️ $customStep->setTarget('.ibexa-header-user-menu__notifications-toggler');
048❇️ $customStep->setTitle('You have unread notifications');
049❇️ $customStep->addBlock(new TextBlock('Click here to preview your unread notifications.'));
050❇️ $customStep->addBlock(new LinkBlock(
051❇️ 'https://doc.ibexa.co/projects/userguide/en/latest/getting_started/notifications/',
052❇️ 'Learn more about notifications'
053❇️ ));
054❇️
055❇️ $scenario->addStep($customStep);
056⫶ }
057⫶
058⫶ private function hasUnreadNotifications(): bool
059⫶ {
060⫶ return $this->notificationService->getPendingNotificationCount() > 0;
061⫶ }
062⫶}


Download colorized diff

@adriendupuis adriendupuis merged commit 2048430 into release-5.0.7 Apr 14, 2026
7 of 8 checks passed
@adriendupuis adriendupuis deleted the release-5.0.7-integratedhelp-deptrac branch April 14, 2026 13:06
@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants