1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

9071 add documentation

This commit is contained in:
Arthur
2022-09-26 14:41:46 -07:00
parent b134d2a7b0
commit 7deb9fde9e

View File

@ -32,6 +32,41 @@ A `PluginMenuItem` has the following attributes:
| `permissions` | - | A list of permissions required to display this link |
| `buttons` | - | An iterable of PluginMenuButton instances to include |
## Optional Header
Plugin menus normally appear under the "Plugins" header. An optional menu_heading can be defined to make the plugin menu to appear as a top level menu header. An example is shown below:
```python
from extras.plugins import PluginMenuButton, PluginMenuItem
from utilities.choices import ButtonColorChoices
menu_heading = {
"title": "Animal Sound",
"icon": "mdi-puzzle"
}
menu_items = (
PluginMenuItem(
link='plugins:netbox_animal_sounds:random_animal',
link_text='Random sound',
buttons=(
PluginMenuButton('home', 'Button A', 'fa fa-info', ButtonColorChoices.BLUE),
PluginMenuButton('home', 'Button B', 'fa fa-warning', ButtonColorChoices.GREEN),
)
),
)
```
The `menu_heading` has the following attributes:
| Attribute | Required | Description |
|---------------|----------|------------------------------------------------------|
| `title` | Yes | The text that will show in the menu header |
| `icon` | Yes | The icon to use next to the headermdi |
!!! tip
The icon names can be found at [Material Design Icons](https://materialdesignicons.com/)
## Menu Buttons
A `PluginMenuButton` has the following attributes: