|
| 1 | +--- |
| 2 | +description: Customize the integrated help menu. |
| 3 | +edition: lts-update |
| 4 | +month_change: true |
| 5 | +--- |
| 6 | + |
| 7 | +# Customize integrated help |
| 8 | + |
| 9 | +The integrated help menu is part of the Integrated help introduced as an [LTS Update](editions.md#lts-updates). |
| 10 | +By default, it provides editors and developers with convenient access to documentation, training and other resources directly from the back office. |
| 11 | + |
| 12 | +You can extend or modify the integrated menu in two ways: |
| 13 | + |
| 14 | +- by disabling it for all users |
| 15 | +- by modifying a link to user documentation |
| 16 | +- by subscribing to the `ibexa_integrated_help.menu_configure.help_menu` event |
| 17 | + |
| 18 | +## Disable integrated help for all users |
| 19 | + |
| 20 | +After you have installed the integrated help package, you may still want to disable it globally, for example, to run UI tests in a `dev` [environment](environments.md). |
| 21 | +To do it, in `config/packages` create the `ibexa_integrated_help.yaml` file, with the following configuration: |
| 22 | + |
| 23 | +``` yaml |
| 24 | +ibexa_integrated_help: |
| 25 | + enabled: false |
| 26 | +``` |
| 27 | +
|
| 28 | +## Modify user documentation link |
| 29 | +
|
| 30 | +[[= product_name =]] provides a comfortable method for replacing a link to user documentation, when you do not want to modify the rest of the integrated help menu. |
| 31 | +This way you can direct application users such as editors or store managers to specific guidelines in force at your organization, without having to resort to development. |
| 32 | +
|
| 33 | +To do it, in `config/packages` create the `ibexa_integrated_help.yaml` file, with the following configuration: |
| 34 | + |
| 35 | +``` yaml |
| 36 | +ibexa_integrated_help: |
| 37 | + user_documentation: <https://custom.user.documentation.address> |
| 38 | +``` |
| 39 | + |
| 40 | +## Intercept and modify event |
| 41 | + |
| 42 | +[[= product_name =]] uses [KnpMenuBundle](https://github.com/KnpLabs/KnpMenuBundle) to build its backend menus. |
| 43 | +When it builds the integrated help menu, it dispatches the `ibexa_integrated_help.menu_configure.help_menu` event to pass information about the contents of the help menu to the front end. |
| 44 | + |
| 45 | +You can intercept this event, and change its contents by creating a subscriber. |
| 46 | +With that subscriber, you can access the `menu` object, which is an instance of the `Knp\Menu\MenuItem`, and all the options passed by this object, and modify them. |
| 47 | +This way you can adjust menu sections that are reproduced by the front end as tabs, add new items, or integrate custom links into the help system. |
| 48 | + |
| 49 | +### Menu object structure |
| 50 | + |
| 51 | +The default `menu` object is structured as follows. |
| 52 | +Recreate this pattern when modifying an existing event with an intention to send it to the front end. |
| 53 | + |
| 54 | +``` |
| 55 | +root (MenuItem) |
| 56 | +│ |
| 57 | +├── help__general // ("General" section) |
| 58 | +│ ├── help__user_documentation // (User docs, highlighted menu option) |
| 59 | +│ │ (...) |
| 60 | +│ └── help__submit_idea // (Submit idea, regular option) |
| 61 | +│ |
| 62 | +└── help__developers // (conditional "Developers" section) |
| 63 | + ├── help__developer_documentation // (Developer docs, highlighted) |
| 64 | + │ (...) |
| 65 | + └── help__support_portal |
| 66 | +``` |
| 67 | +
|
| 68 | +`help_general` and `help_developers` are menu sections, or tabs. |
| 69 | +Sections consist of entries, and each entry carries the following information: |
| 70 | +
|
| 71 | +- `label` - a name of the help menu item |
| 72 | +- `uri` - an external link to the resource |
| 73 | +- `isHighlighted` - a Boolean switch that decides whether the menu item should be placed at the top of the tab |
| 74 | +- `icon` - a link to a graphic file to accompany the menu item |
| 75 | +- `description` - a summary of what users can expect after clicking the menu item |
| 76 | +
|
| 77 | +### Create a subscriber |
| 78 | +
|
| 79 | +Build a subscriber that intercepts the event and modifies it. |
| 80 | +In this example, it removes a product roadmap entry from the menu and adds a help menu tab with links to product videos. |
| 81 | +The tab is displayed in a production environment only. |
| 82 | +
|
| 83 | +``` php |
| 84 | +[[= include_file('code_samples/back_office/menu/menu_item/src/EventSubscriber/HelpMenuSubscriber.php') =]] |
| 85 | +``` |
| 86 | + |
| 87 | +!!! tip |
| 88 | + |
| 89 | + If `autoconfigure` is enabled, the event subscriber is registered as a service by default. |
| 90 | + If not, register it as a service and tag with `kernel.event.subscriber`. |
| 91 | + |
| 92 | + ```yaml |
| 93 | + services: |
| 94 | + App\EventSubscriber\HelpMenuSubscriber: |
| 95 | + arguments: |
| 96 | + $kernelDebug: '%kernel.debug%' |
| 97 | + tags: |
| 98 | + - { name: kernel.event_subscriber } |
| 99 | + ``` |
| 100 | + |
| 101 | +For more ideas on how you can extend the help menu, see [Back office menus](back_office_menus.md). |
0 commit comments