Skip to content

Commit

Permalink
doc
Browse files Browse the repository at this point in the history
  • Loading branch information
PipoCanaja committed Aug 11, 2024
1 parent 6c98ab8 commit 8ccac43
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions doc/Extensions/Plugin-System.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ LibreNMS. An example plugin is included in the LibreNMS distribution.

Plugins in version 2 need to be installed into app/Plugins

>Note: Plugins are disabled when the have an error, to show errors instead, set plugins.show_errors:
>Note: Plugins are disabled when they throw an error/exception. In order to show errors instead, set plugins.show_errors:
`lnms config:set plugins.show_errors true`

The structure of a plugin is follows:
Expand All @@ -37,9 +37,7 @@ app/Plugins
/settings.blade.php
```

The above structure is checked before a plugin can be installed.

All file/folder names are case sensitive and must match the structure.
All file/folder names are case-sensitive and must match the structure.

Only the class & blade files that are really needed need to be created. A plugin manager
will then load a hook that has a basic functionality.
Expand Down Expand Up @@ -91,9 +89,11 @@ PHP code should run inside your hooks method and not your blade view.
The built in hooks support authorize and data methods.

These methods are called with [Dependency Injection](https://laravel.com/docs/container#method-invocation-and-injection)
Hooks with relevant database models will include them in these calls.
Hooks with relevant database models will include them in these calls. Each class file will implement at most one hook.
Additionally, the settings argument may be included to inject the plugin settings into the method.

Note that namespace in all class files must match `PluginName`.

#### Data

You can overrid the data method to supply data to your view. You should also do any processing here.
Expand Down

0 comments on commit 8ccac43

Please sign in to comment.