✨ Support for changing hook order & sorting context (#4186)

* Add support for changing hook order
Default hook value changed from None to 1000

* ♻️ Refactor sorting override logic

  * fetch settings during platform initialization instead of in plugin core
  * rename from hook order to sorting order as it's also used for the
    sorting context of implementations
  * make sure settings are initialized empty in defaults

* 📝 Add missing docs for sorting order overrides

* ✨ Fully support reordering of implementations too

Co-authored-by: Gina Häußge <gina@octoprint.org>
This commit is contained in:
Shawn BruceandGina Häußge authored and GitHub committed 2022-02-22 11:16:46 +01:00
1 parent 33b45768a2
commit 80ffa8865e
5 files changed
+40 -4

No files matched your search

+8
View File
@@ -561,6 +561,14 @@ plugins are tracked:
_forcedCompatible:
- ...
# Custom sorting of hooks and implementations provided by plugins. Two-tiered dictionary
# structure, plugin identifier mapping to a dictionary of order overrides mapped by
# sorting context/hook name
_sortingOrder:
some_plugin:
some_hook: 1
some_other_hook: 200
# The rest are individual plugin settings, each tracked by their identifier, e.g.:
some_plugin:
some_setting: true