Fix broken plugin state

This commit is contained in:
Chocobozzz
2021-12-23 11:25:54 +01:00
parent e63eede42f
commit dffbf8b577
2 changed files with 22 additions and 1 deletions

View File

@ -26,10 +26,26 @@ function register ({ registerHook, registerVideoField }) {
type: 'input-checkbox'
}
const commonOptions4 = {
name: 'hello-world-field-4',
label: 'Super field 4 in main tab',
type: 'input-checkbox',
hidden: ({ formValues }) => {
return formValues['privacy'] !== 1 && formValues['privacy'] !== 2
},
error: ({ formValues, value }) => {
if (formValues['privacy'] !== 1 && formValues['privacy'] !== 2) return { error: false }
if (value === true) return { error: false }
return { error: true, text: 'Should be enabled' }
}
}
for (const type of [ 'upload', 'import-url', 'update' ]) {
registerVideoField(commonOptions1, { type })
registerVideoField(commonOptions2, { type })
registerVideoField(commonOptions3, { type })
registerVideoField(commonOptions4, { type, tab: 'main' })
}
}