aboutsummaryrefslogtreecommitdiffhomepage
path: root/support/doc
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-12-22 18:02:36 +0100
committerChocobozzz <me@florianbigard.com>2021-12-29 10:10:01 +0100
commit3c065fe3b3e1385d59ad1980251d14b712648155 (patch)
treef5f7f1b428b8155a735014304e2d45b9ed92fe07 /support/doc
parent61cc1c03bf6f12af7c1b2e2a7d2fdaa563c37b59 (diff)
downloadPeerTube-3c065fe3b3e1385d59ad1980251d14b712648155.tar.gz
PeerTube-3c065fe3b3e1385d59ad1980251d14b712648155.tar.zst
PeerTube-3c065fe3b3e1385d59ad1980251d14b712648155.zip
Enhance plugin video fields
Add video form tab selection Add ability to display an error
Diffstat (limited to 'support/doc')
-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```