-
Notifications
You must be signed in to change notification settings - Fork 82
IBX-10163: Document integrated help #2937
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
dabrt
wants to merge
5
commits into
5.0
Choose a base branch
from
IBX-10163
base: 5.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
code_samples/back_office/menu/menu_item/src/EventSubscriber/HelpMenuSubscriber.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\EventSubscriber; | ||
|
||
use Symfony\Component\EventDispatcher\EventSubscriberInterface; | ||
use Symfony\Contracts\EventDispatcher\Event; | ||
|
||
final class HelpMenuSubscriber implements EventSubscriberInterface | ||
{ | ||
public function __construct( | ||
private readonly bool $kernelDebug | ||
) { | ||
} | ||
|
||
public static function getSubscribedEvents(): array | ||
{ | ||
return [ | ||
'ibexa_integrated_help.menu_configure.help_menu' => 'onHelpMenuConfigure', | ||
]; | ||
} | ||
|
||
public function onHelpMenuConfigure(Event $event): void | ||
{ | ||
$menu = $event->getMenu(); | ||
|
||
// Remove roadmap menu item | ||
if ($menu->getChild('help__general')) { | ||
$generalSection = $menu->getChild('help__general'); | ||
if ($generalSection->getChild('help__product_roadmap')) { | ||
$generalSection->removeChild('help__product_roadmap'); | ||
} | ||
} | ||
|
||
// Add videos tab, shown only in production | ||
if ($this->kernelDebug === false) { | ||
$resourcesSection = $menu->addChild('help__videos', [ | ||
'label' => 'Product videos', | ||
]); | ||
|
||
$resourcesSection->addChild('help__webinar_v5', [ | ||
'label' => 'Webinar: Introducing Ibexa DXP v5', | ||
'uri' => 'https://www.youtube.com/watch?v=qWaBHG2LRm8', | ||
'extras' => [ | ||
'isHighlighted' => false, | ||
'icon' => 'https://doc.ibexa.co/en/5.0/templating/twig_function_reference/img/icons/video.svg.png', | ||
'description' => 'Discover new features and improvements brought by Ibexa DXP v5.', | ||
], | ||
]); | ||
} | ||
} | ||
} |
90 changes: 90 additions & 0 deletions
90
docs/administration/back_office/customize_integrated_help.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
--- | ||
description: Customize the integrated help menu. | ||
edition: lts-update | ||
month_change: true | ||
--- | ||
|
||
# Customize integrated help | ||
|
||
The integrated help menu is part of the Integrated help introduced as an LTS Update. | ||
By default, it provides editors and developers with convenient access to documentation, training and other resources directly from the back office. | ||
|
||
You can extend or modify the integrated menu in two ways: | ||
|
||
- by modifying a link to user documentation in a yaml file | ||
- by subscribing to the `ibexa_integrated_help.menu_configure.help_menu` event | ||
|
||
## Modify user documentation link | ||
|
||
[[= 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. | ||
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. | ||
|
||
To do in, in `config/packages` create the `ibexa_integrated_help.yaml` file, with the following configuration: | ||
|
||
``` yaml | ||
ibexa_integrated_help: | ||
user_documentation: <https://custom.user.documentation.address> | ||
``` | ||
|
||
## Intercept and modify event | ||
|
||
[[= product_name =]] uses [KnpMenuBundle](https://github.com/KnpLabs/KnpMenuBundle) to build its backend menus. | ||
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. | ||
|
||
You can intercept this event, and change its contents by creating a subscriber. | ||
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. | ||
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. | ||
|
||
### Menu object structure | ||
|
||
The default `menu` object is structured as follows. | ||
Recreate this pattern when modifying an existing event with an intention to send it to the front end. | ||
|
||
``` | ||
root (MenuItem) | ||
│ | ||
├── help__general // ("General" section) | ||
│ ├── help__user_documentation // (User docs, highlighted menu option) | ||
│ │ (...) | ||
│ └── help__submit_idea // (Submit idea, regular option) | ||
│ | ||
└── help__developers // (conditional "Developers" section) | ||
├── help__developer_documentation // (Developer docs, highlighted) | ||
│ (...) | ||
└── help__support_portal | ||
``` | ||
|
||
`help_general` and `help_developers` are menu sections, or tabs. | ||
Sections consist of entries, and each entry carries the following information: | ||
|
||
- `label` - a name of the help menu item | ||
- `uri` - an external link to the resource | ||
- `isHighlighted` - a Boolean switch that decides whether the menu item should be placed at the top of the tab | ||
- `icon` - a link to a graphic file to accompany the menu item | ||
- `description` - a summary of what users can expect after clicking the menu item | ||
|
||
### Create a subscriber | ||
|
||
Build a subscriber that intercepts the event and modifies it. | ||
In this example, it removes a product roadmap entry from the menu and adds a help menu tab with links to product videos. | ||
The tab is displayed in a production environment only. | ||
|
||
``` php | ||
[[= include_file('code_samples/back_office/menu/menu_item/src/EventSubscriber/HelpMenuSubscriber.php') =]] | ||
``` | ||
|
||
!!! tip | ||
|
||
If `autoconfigure` is enabled, the event subscriber is registered as a service by default. | ||
If not, register it as a service and tag with `kernel.event.subscriber`. | ||
|
||
```yaml | ||
services: | ||
App\EventSubscriber\HelpMenuSubscriber: | ||
arguments: | ||
$kernelDebug: '%kernel.debug%' | ||
tags: | ||
- { name: kernel.event_subscriber } | ||
``` | ||
|
||
For more ideas on how you can extend the help menu, see [Back office menus](back_office_menus.md). |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--- | ||
description: Integrated help provides quick access to documentation, training, and support resources. | ||
month_change: true | ||
--- | ||
|
||
# Integrated help | ||
|
||
Integrated help is an LTS Update that brings documentation, training resources and product roadmap-related information into the back office. | ||
With this feature installed, users can click the {.inline-image} icon to access relevant content straight from the UI. | ||
|
||
 | ||
|
||
Integrated help is contextual, therefore, apart from user documentation, release notes, and partner guidelines, which are available to editors and store managers, developers can access API references, the GraphQL console, or the support portal. | ||
|
||
## Install package | ||
|
||
Integrated help is optional. | ||
To enable it, run the following command: | ||
|
||
```bash | ||
composer require ibexa/integrated-help | ||
``` | ||
|
||
## Customize help menu | ||
|
||
You can extend or alter the integrated help menu by quickly changing the link to user documentation, or adding or removing menu items or even entire menu sections. | ||
|
||
For more information, see [Customize integrated help](customize_integrated_help.md). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.