aboutsummaryrefslogtreecommitdiffhomepage
path: root/support/doc/plugins/guide.md
diff options
context:
space:
mode:
Diffstat (limited to 'support/doc/plugins/guide.md')
-rw-r--r--support/doc/plugins/guide.md17
1 files changed, 16 insertions, 1 deletions
diff --git a/support/doc/plugins/guide.md b/support/doc/plugins/guide.md
index 26fcb8987..5c1f6a2af 100644
--- a/support/doc/plugins/guide.md
+++ b/support/doc/plugins/guide.md
@@ -692,16 +692,31 @@ async function register ({ registerVideoField, peertubeHelpers }) {
692 type: 'input-textarea', 692 type: 'input-textarea',
693 693
694 default: '', 694 default: '',
695
695 // Optional, to hide a field depending on the current form state 696 // Optional, to hide a field depending on the current form state
696 // liveVideo is in the options object when the user is creating/updating a live 697 // liveVideo is in the options object when the user is creating/updating a live
697 // videoToUpdate is in the options object when the user is updating a video 698 // videoToUpdate is in the options object when the user is updating a video
698 hidden: ({ formValues, videoToUpdate, liveVideo }) => { 699 hidden: ({ formValues, videoToUpdate, liveVideo }) => {
699 return formValues.pluginData['other-field'] === 'toto' 700 return formValues.pluginData['other-field'] === 'toto'
701 },
702
703 // Optional, to display an error depending on the form state
704 error: ({ formValues, value }) => {
705 if (formValues['privacy'] !== 1 && formValues['privacy'] !== 2) return { error: false }
706 if (value === true) return { error: false }
707
708 return { error: true, text: 'Should be enabled' }
700 } 709 }
701 } 710 }
702 711
712 const videoFormOptions = {
713 // Optional, to choose to put your setting in a specific tab in video form
714 // type: 'main' | 'plugin-settings'
715 tab: 'main'
716 }
717
703 for (const type of [ 'upload', 'import-url', 'import-torrent', 'update', 'go-live' ]) { 718 for (const type of [ 'upload', 'import-url', 'import-torrent', 'update', 'go-live' ]) {
704 registerVideoField(commonOptions, { type }) 719 registerVideoField(commonOptions, { type, ...videoFormOptions })
705 } 720 }
706} 721}
707``` 722```