You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/PLUGINS.md
+89-1Lines changed: 89 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@
12
12
-[Object field](#object-field)
13
13
-[Restrictions](#restrictions)
14
14
-[Json field](#json-field)
15
-
15
+
-[Hooks](#hooks)
16
16
17
17
Each plugin should be created handle a specific part of the data.
18
18
Avoid creating a single plugin to handle all the data, as this will make the code harder to maintain and understand.
@@ -389,3 +389,91 @@ The `json` field is an escape-hatch that allows the user to input any JSON data.
389
389
```
390
390
391
391

392
+
393
+
## Hooks
394
+
395
+
> [!WARNING]
396
+
> The hooks are an advanced feature and should be used with caution.
397
+
398
+
Hooks are functions that can be added to the plugins to perform actions at specific points in their lifecycle.
399
+
400
+
Available hooks:
401
+
-`onAfterInit(targetInstance: Plugin, data: any) => void` - Executed after the target plugin's `init` function. Can be a promise.
402
+
-`onAfterEditSchema(targetInstance: Plugin, formData: any, schema: PluginEditSchema) => PluginEditSchema` - Allows changing a plugin's schema. Receives the schema returned by the target plugin's `editSchema` function and the data entered in the form. Should return the modified schema.
403
+
404
+
Hooks should be registered in the plugin's constructor:
Whenever an STAC extension plugin is added, it should add the extension to the `stac_extensions` field of the CollectionsCore plugin. This will allow the interface to show the extension as an option in the dropdown.
436
+
437
+
This can be achieved with th `onAfterEditSchema` hook:
0 commit comments