[pve-devel] [RFC pve-storage master v1 05/12] plugin: add new plugin API method `get_form_view()`
Max R. Carrara
m.carrara at proxmox.com
Mon Sep 8 20:00:49 CEST 2025
This method returns a nested hashref containing the form view
definition for the given plugin in `$class`. The returned hashref must
correspond to the form view schema in the `::Plugin::Views` package.
Plugins that define a form view must specify so in `plugindata()`:
sub plugindata {
return {
# [...]
views => {
form => 1,
},
};
}
Returns undef by default otherwise.
`get_form_view()` takes a single parameter (besides `$class`) named
`$context`, which is a hashref that contains additional context vars
that may or may not be taken account by the method.
Currently, the only such context variable is `mode`, which can be
either 'create' or 'update', corresponding to whether a configuration
entry belonging to the plugin is being created or edited (-> updated).
Signed-off-by: Max R. Carrara <m.carrara at proxmox.com>
---
src/PVE/Storage/Plugin.pm | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/PVE/Storage/Plugin.pm b/src/PVE/Storage/Plugin.pm
index 2291d72..0356a25 100644
--- a/src/PVE/Storage/Plugin.pm
+++ b/src/PVE/Storage/Plugin.pm
@@ -684,6 +684,14 @@ sub on_delete_hook {
return undef;
}
+# TODO: POD docstring
+sub get_form_view {
+ my ($class, $context) = @_;
+
+ # no form view defined by default
+ return undef;
+}
+
sub cluster_lock_storage {
my ($class, $storeid, $shared, $timeout, $func, @param) = @_;
--
2.47.2
More information about the pve-devel
mailing list