Skip to content

Commit 0b4a2f7

Browse files
committed
Review feedback
1 parent e5e94f2 commit 0b4a2f7

File tree

7 files changed

+106
-112
lines changed

7 files changed

+106
-112
lines changed

TODO

Lines changed: 3 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,6 @@
11
TODO:
22
1) PHP API reference + links
33
2) Arcade video
4-
1) Czy typ image działa? Chyba nie?
5-
5) Screenshoty
6-
6) Custom block type?
7-
8-
---
9-
description: Customize product tour scenarios by creating custom step blocks
10-
edition: lts-update
11-
month_change: false
12-
---
13-
14-
# Create custom step blocks
15-
16-
TODO: This is not possible
17-
18-
When creating [product tour scenarios](integrated_help.md#product-tours) you're not limited to the [built-in step blocks](configure_product_tour.md#block-types).
19-
You can create custom block types, allowing you create reusable blocks that can be shared between scenarios.
20-
21-
It's a more customizable alternative the [custom Twig block](configure_product_tour.md#custom-twig-template-block), as you can pass custom variables and add additional logic before rendering the template.
22-
23-
The following example creates a custom `tip` block, a reusable component that you can use in different steps to provide tips to the user.
24-
25-
To create a custom step block, start by creating a class implementing the `Ibexa\Contracts\IntegratedHelp\Builder\Block\BlockBuilderInterface` interface.
26-
This class is responsbile for converting the YAML configuration into PHP objects.
27-
28-
``` php
29-
```
30-
31-
Register it as a Symfony service and use the `ibexa.product_tour.block_factory` service tag to register is as a custom block configuration option:
32-
33-
``` yaml
34-
```
35-
36-
Then, create a class responsible for rendering the block:
37-
38-
``` php
39-
```
40-
41-
Register it as a Symfony service and use the `ibexa.product_tour.block_renderer` service tag to mark the class as a custom block renderer.
42-
43-
``` yaml
44-
45-
```
4+
3) Screenshoty
5+
4) Przekazywanie danych do tagu typu video - czy tylko url?
6+
5) Stylowanie custom twig template

docs/administration/back_office/configure_product_tour.md

Lines changed: 41 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ You can configure the product tour scenarios to adapt it to your project needs,
1111
Product tour scenarios are configured using YAML configuration files.
1212
Configuration is SiteAccess-aware, allowing you to create separate onboarding experiences for different back offices in [multisite setups](multisite.md).
1313

14-
For more advanced customization cases that require PHP code, see the [integrated help's `RenderProductTourScenarioEvent`](integrated_help_events.md).
14+
For more advanced customization cases that require PHP code, see [Customize product tour](customize_product_tour.md).
1515

1616
Use the default provided configuration, available in `config/packages/ibexa_integrated_help_tours.yaml`, as a starting point that you can adjust to your needs.
1717

@@ -31,7 +31,7 @@ ibexa:
3131
type: <general|targetable>
3232
user_groups_excluded: [<user_group_remote_content_id>, ...] # Optional
3333
steps:
34-
<step_key>: # Scenario step
34+
<step_identifier>: # Scenario step, unique within a scenario
3535
step_title_translation_key: <translation_key>
3636
background_image: <image_path> # Only for general type, optional
3737
target: <css_selector> # Only for targetable type, required
@@ -60,6 +60,8 @@ tour.list.item2: "Second item"
6060
tour.list.item3: "Third item"
6161
```
6262
63+
To insert a line break into a translation, HTML encode the `<br>` entities to `&lt;br/&gt;`.
64+
6365
## Scenario configuration
6466

6567
Each scenario must specify its type and can optionally restrict access by user groups.
@@ -68,7 +70,7 @@ Each scenario must specify its type and can optionally restrict access by user g
6870

6971
The order of scenarios in the configuration file determines the order in which they are evaluated and, if the right conditions are met, displayed.
7072

71-
For **general scenario**, the scenario appears at the earliest opportunity (on any page after logging in).
73+
For **general scenario**, the scenario appears at the earliest opportunity (on any page after logging in), with an exception of the user settings area.
7274

7375
For **targeted scenarios**, the scenario begins if the target element is found in the DOM.
7476
This means the scenario only appears on pages where the target element exists.
@@ -88,17 +90,22 @@ product_tour:
8890

8991
### User group restrictions
9092

91-
Restrict tour visibility by excluding specific user groups by using their content remote IDs:
93+
Restrict scenario visibility by excluding specific user groups by using their content remote IDs:
9294

9395
```yaml
9496
product_tour:
95-
my_tour:
97+
my_scenario:
9698
user_groups_excluded: ['user_group_content_remote_id_1', 'user_group_content_remote_id_2'] # Exclude specific user groups
9799
```
98100

99101
When creating new [back office user groups](user_registration.md#user-types), you should decide whether the existing product tour scenarios should be available for the new user group.
100102
If not, add the new group to the exclusion list.
101103

104+
!!! warning
105+
106+
If a scenario contains information meant only for specific group of users, always use the `user_groups_excluded` setting to exclude other groups.
107+
Don't rely only on UI access restrictions to control the access to scenarios, as a malicious internal user could trigger and preview them outside of the intended place.
108+
102109
## Step configuration
103110

104111
Steps define individual instructions within a scenario.
@@ -123,6 +130,7 @@ You can select a specific element by using the `target` setting.
123130

124131
If a step's target element doesn't exist on the page, the step isn't be displayed and the scenario is be stopped.
125132
Ensure your configuration matches the actual DOM structure to avoid broken scenarios.
133+
Use unique selectors to avoid triggering your scenarios on other pages.
126134

127135
#### Interaction modes
128136

@@ -131,6 +139,12 @@ Targeted steps support [three interaction modes](product_tour.md#targeted-scenar
131139

132140
TODO: 2 pane screenshot here, showing the UI for each of types.
133141

142+
!!! note
143+
144+
Clickable and draggable modes are designed for single actions only (buttons, links).
145+
You can't select an entire form.
146+
If the interaction with the highlighted element results in redirection to a new page or opening a modal window where the previous target element can't be found, the "Previous" navigation step will be disabled.
147+
134148
**Standard mode**:
135149

136150
The default value. A tooltip attached to specific element on the page is displayed.
@@ -149,12 +163,6 @@ Users continue the scenario by clicking the highlighted element.
149163
[[= include_file('code_samples/back_office/product_tour/config/targetable_scenario.yaml', 15, 23) =]]
150164
```
151165

152-
!!! note
153-
154-
Clickable mode is designed for single actions only (buttons, links).
155-
You can't select an entire form.
156-
If the interaction with the highlighted element results in redirection to a new page or opening a modal window where the previous target element can't be found, the "Previous" navigation step will be disabled.
157-
158166
**Draggable mode**:
159167

160168
A tooltip attached to specific element on the page is displayed.
@@ -168,6 +176,7 @@ Users continue the scenario by [dragging](https://developer.mozilla.org/en-US/do
168176

169177
Blocks are content elements that make up each step, available both for `general` and `targetable` scenarios.
170178
Seven block types are available for building step content, and a scenario step must contain at least one.
179+
If multiple blocks are defined for a step, they are displayed one after the other.
171180

172181
TODO: Step screenshot with all 7 blocks available?
173182

@@ -195,32 +204,40 @@ Add external or internal links:
195204
[[= include_file('code_samples/back_office/product_tour/config/general_scenario.yaml', 17, 21) =]]
196205
```
197206

198-
### Image block
207+
### List block
199208

200-
Embed images with alternative text:
209+
Create bulleted lists with title:
201210

202211
```yaml
203-
[[= include_file('code_samples/back_office/product_tour/config/general_scenario.yaml', 21, 25) =]]
212+
[[= include_file('code_samples/back_office/product_tour/config/general_scenario.yaml', 29, 36) =]]
204213
```
205214

206-
### Video block
215+
The `title_translation_key` property is optional.
207216

208-
Embed video content by using the [`video` HTML element](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/video):
217+
### Media blocks
218+
219+
To provide data to the media block, place your image or video files in the `public` directory and provide the relative path to it.
220+
221+
!!! tip
222+
223+
To resolve the path relative to the site root, [prefix it with `/`](https://developer.mozilla.org/en-US/docs/Web/API/URL_API/Resolving_relative_references#root_relative).
224+
225+
#### Image block
226+
227+
Embed images with alternative text:
209228

210229
```yaml
211-
[[= include_file('code_samples/back_office/product_tour/config/general_scenario.yaml', 25, 29) =]]
230+
[[= include_file('code_samples/back_office/product_tour/config/general_scenario.yaml', 21, 25) =]]
212231
```
213232

214-
### List block
233+
#### Video block
215234

216-
Create bulleted lists with title:
235+
Embed video content by using the [`video` HTML element](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/video):
217236

218237
```yaml
219-
[[= include_file('code_samples/back_office/product_tour/config/general_scenario.yaml', 29, 36) =]]
238+
[[= include_file('code_samples/back_office/product_tour/config/general_scenario.yaml', 25, 29) =]]
220239
```
221240

222-
The `title_translation_key` property is optional.
223-
224241
### Custom Twig template block
225242

226243
For advanced content, use custom Twig templates that allows you to fully control the styling of the block:
@@ -260,3 +277,5 @@ The following example showcases the 3 interaction modes of a `targetable` scenar
260277
```yaml
261278
[[= include_file('code_samples/back_office/product_tour/config/targetable_scenario.yaml') =]]
262279
```
280+
281+
To learn how to customize your scenarios even further with PHP code, see [Customize product tour](customize_product_tour.md).
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
description: Customize product tour scenarios with custom event listeners
3+
edition: lts-update
4+
month_change: true
5+
---
6+
7+
# Customize scenarios with PHP code
8+
9+
You can customize the product tour scenarios with the [`RenderProductTourScenarioEvent`](integrated_help_events.md) event.
10+
This event is dispatched before rendering a product tour scenario and you can use it to:
11+
12+
- Modify tour steps based on user permissions or roles
13+
- Add or remove steps dynamically
14+
- Change block content based on runtime conditions
15+
- Integrate custom data into tour scenarios
16+
17+
With the following example, a custom onboarding scenario is built.
18+
It starts only when the current user has a pending [notification]([[= user_doc =]]/getting_started/notifications/).
19+
20+
First, define a custom product tour scenario.
21+
It contains a placeholder step with a single block.
22+
23+
``` yaml
24+
ibexa:
25+
system:
26+
default:
27+
product_tour:
28+
notifications:
29+
type: 'targetable'
30+
steps:
31+
placeholder_step:
32+
step_title_translation_key: 'This is a placeholder step'
33+
target: '.ibexa-header-user-menu__notifications-toggler'
34+
blocks:
35+
- type: text
36+
params:
37+
text_translation_key: 'This is a placeholder block, modified during event subscriber execution'
38+
```
39+
40+
Then, create a subscriber modifying the scenario.
41+
42+
```php hl_lines="35-37 39-41 43-45 47-58"
43+
[[= include_file('code_samples/back_office/product_tour/src/EventSubscriber/NotificationScenarioSubscriber.php') =]]
44+
```
45+
46+
The subscriber executes the following actions:
47+
48+
- makes sure the correct scenario is being processed
49+
- removes all the existing scenario steps
50+
- verifies that the current user has a pending notification
51+
- adds a custom clickable step to highlight the unread notification
52+
53+
TODO: Screenshot here

docs/administration/back_office/integrated_help.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ After installation, you must [enable the help center in user settings]([[= user_
3939
"administration/back_office/customize_integrated_help",
4040
"administration/back_office/product_tour",
4141
"administration/back_office/configure_product_tour",
42+
"administration/back_office/customize_product_tour",
4243
"api/event_reference/integrated_help_events",
4344
]) =]]
4445

docs/administration/back_office/product_tour.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,12 @@ TODO: Screenshot here
6666
Depending on scenario configuration, they automatically appear to users when they first log in or visit a specific page.
6767
Each scenario appears only once for each user.
6868

69-
Users can complete a tour by finishing all steps or by skipping it with the "Exit tour" button.
69+
Users can complete a tour with one of the following actions:
70+
71+
- by finishing all steps
72+
- by skipping it with the **Exit tour** button
73+
- by skipping it with the **Escape** key
74+
7075
At any time, users can manually restart completed tours from their [user settings]([[= user_doc =]]/getting_started/get_started/#user-settings).
7176

7277
To start building your custom onboarding scenarios, see [configure product tour](configure_product_tour.md).

docs/api/event_reference/integrated_help_events.md

Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -15,50 +15,4 @@ The following event is dispatched when rendering a [product tour scenario](produ
1515
|---|---|
1616
|`RenderProductTourScenarioEvent`|`Ibexa\IntegratedHelp\Renderer\ProductTourRenderer::render()`|
1717

18-
### RenderProductTourScenarioEvent
19-
20-
TODO: Move to "Customize product tour?" Maybe it's a better place
21-
22-
This event is dispatched before rendering a product tour scenario and you can use it to:
23-
24-
- Modify tour steps based on user permissions or roles
25-
- Add or remove steps dynamically
26-
- Change block content based on runtime conditions
27-
- Integrate custom data into tour scenarios
28-
29-
With the following example, the scenario is modified to trigger only when certain conditions are matched. When the current user has a pending [notification]([[= user_doc =]]/getting_started/notifications/), a custom onboarding scenario is triggered.
30-
31-
First, define a custom product tour scenario.
32-
It contains a placeholder step with a single block.
33-
34-
``` yaml
35-
ibexa:
36-
system:
37-
default:
38-
product_tour:
39-
notifications:
40-
type: 'targetable'
41-
steps:
42-
placeholder_step:
43-
step_title_translation_key: 'This is a placeholder step'
44-
target: '.ibexa-header-user-menu__notifications-toggler'
45-
blocks:
46-
- type: text
47-
params:
48-
text_translation_key: 'This is a placeholder block, modified during event subscriber execution'
49-
```
50-
51-
Then, create a subscriber modifying the scenario.
52-
53-
```php hl_lines="35-37 39-41 43-45 47-58"
54-
[[= include_file('code_samples/back_office/product_tour/src/EventSubscriber/NotificationScenarioSubscriber.php') =]]
55-
```
56-
57-
The subscriber executes the following actions:
58-
59-
- makes sure the correct scenario is being processed
60-
- removes all the existing scenario steps
61-
- verifies that the current user has a pending notification
62-
- adds a custom clickable step to highlight the unread notification
63-
64-
TODO: Screenshot here
18+
To learn how you can use this event to customize your product tour scenarios, see [Customize product tour](customize_product_tour.md).

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ nav:
167167
- Customize integrated help: administration/back_office/customize_integrated_help.md
168168
- Product tour: administration/back_office/product_tour.md
169169
- Configure product tour: administration/back_office/configure_product_tour.md
170+
- Customize product tour: administration/back_office/customize_product_tour.md
170171
- Customize search:
171172
- Customize search suggestion: administration/back_office/customize_search_suggestion.md
172173
- Customize search sorting: administration/back_office/customize_search_sorting.md

0 commit comments

Comments
 (0)