[doc] octoprint.ui.web.templatetypes hook is now documented
This commit is contained in:
1 parent
804d832544
commit
fde543f19e
3 files changed
+123
-8
No files matched your search
@@ -178,7 +178,7 @@ class TemplatePlugin(OctoPrintPlugin, ReloadNeedingPlugin):
|
||||
"""
|
||||
Using the ``TemplatePlugin`` mixin plugins may inject their own components into the OctoPrint web interface.
|
||||
|
||||
Currently OctoPrint supports the following types of injections:
|
||||
Currently OctoPrint supports the following types of injections out of the box:
|
||||
|
||||
Navbar
|
||||
The right part of the navigation bar located at the top of the UI can be enriched with additional links. Note that
|
||||
@@ -248,13 +248,16 @@ class TemplatePlugin(OctoPrintPlugin, ReloadNeedingPlugin):
|
||||
Plugins may replace existing components, see the ``replaces`` keyword in the template configurations returned by
|
||||
:meth:`.get_template_configs` below. Note that if a plugin replaces a core component, it is the plugin's
|
||||
responsibility to ensure that all core functionality is still maintained.
|
||||
|
||||
Plugins can also add additional template types by implementing the :ref:`octoprint.ui.web.templatetypes <sec-plugins-hook-ui-web-templatetypes>` hook.
|
||||
"""
|
||||
|
||||
def get_template_configs(self):
|
||||
"""
|
||||
Allows configuration of injected navbar, sidebar, tab and settings templates. Should be a list containing one
|
||||
configuration object per template to inject. Each configuration object is represented by a dictionary which
|
||||
may contain the following keys:
|
||||
Allows configuration of injected navbar, sidebar, tab and settings templates (and also additional templates of
|
||||
types specified by plugins through the :ref:`octoprint.ui.web.templatetypes <sec-plugins-hook-ui-web-templatetypes>` hook).
|
||||
Should be a list containing one configuration object per template to inject. Each configuration object is
|
||||
represented by a dictionary which may contain the following keys:
|
||||
|
||||
.. list-table::
|
||||
:widths: 5 95
|
||||
|
||||
@@ -60,10 +60,9 @@ def index():
|
||||
hooks = pluginManager.get_hooks("octoprint.ui.web.templatetypes")
|
||||
for name, hook in hooks.items():
|
||||
try:
|
||||
result = hook(dict(template_rules))
|
||||
result = hook(dict(template_sorting), dict(template_rules))
|
||||
except:
|
||||
# TODO
|
||||
pass
|
||||
_logger.exception("Error while retrieving custom template type definitions from plugin {name}".format(**locals()))
|
||||
else:
|
||||
if not isinstance(result, list):
|
||||
continue
|
||||
|
||||
Reference in new issue
Block a user