From 0f319334065fae8756fe7c7eec333000474d07ba Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 22 Apr 2021 14:25:32 +0200 Subject: Add ability to hide plugin form fields --- support/doc/plugins/guide.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'support/doc/plugins/guide.md') diff --git a/support/doc/plugins/guide.md b/support/doc/plugins/guide.md index ca951c781..8d85092e7 100644 --- a/support/doc/plugins/guide.md +++ b/support/doc/plugins/guide.md @@ -623,7 +623,13 @@ async function register ({ registerVideoField, peertubeHelpers }) { label: 'My added field', descriptionHTML: 'Optional description', type: 'input-textarea', - default: '' + default: '', + // Optional, to hide a field depending on the current form state + // liveVideo is in the options object when the user is creating/updating a live + // videoToUpdate is in the options object when the user is updating a video + hidden: ({ formValues, videoToUpdate, liveVideo }) => { + return formValues.pluginData['other-field'] === 'toto' + } } for (const type of [ 'upload', 'import-url', 'import-torrent', 'update', 'go-live' ]) { -- cgit v1.2.3