Remove yesno option from Storage backend

This commit is contained in:
Hypolite Petovan 2020-02-05 21:37:32 -05:00
parent dad6b43689
commit a7a38da62d
3 changed files with 8 additions and 3 deletions

View file

@ -73,7 +73,6 @@ Optional. Depends on which 'type' this option is:
- 'select': array `[ value => label ]` of choices - 'select': array `[ value => label ]` of choices
- 'intcheckbox': value of input element - 'intcheckbox': value of input element
- 'select_raw': prebuild html string of `<option >` tags - 'select_raw': prebuild html string of `<option >` tags
- 'yesno': array `[ 'label no', 'label yes']`
Each label should be translatable Each label should be translatable

View file

@ -63,7 +63,7 @@ interface IStorage
* 'type', // define the field used in form, and the type of data. * 'type', // define the field used in form, and the type of data.
* // one of 'checkbox', 'combobox', 'custom', 'datetime', * // one of 'checkbox', 'combobox', 'custom', 'datetime',
* // 'input', 'intcheckbox', 'password', 'radio', 'richtext' * // 'input', 'intcheckbox', 'password', 'radio', 'richtext'
* // 'select', 'select_raw', 'textarea', 'yesno' * // 'select', 'select_raw', 'textarea'
* *
* 'label', // Translatable label of the field * 'label', // Translatable label of the field
* 'value', // Current value * 'value', // Current value
@ -72,7 +72,6 @@ interface IStorage
* // select: array [ value => label ] of choices * // select: array [ value => label ] of choices
* // intcheckbox: value of input element * // intcheckbox: value of input element
* // select_raw: prebuild html string of < option > tags * // select_raw: prebuild html string of < option > tags
* // yesno: array [ 'label no', 'label yes']
* ] * ]
* *
* See https://github.com/friendica/friendica/wiki/Quick-Template-Guide * See https://github.com/friendica/friendica/wiki/Quick-Template-Guide

View file

@ -556,6 +556,13 @@ class Site extends BaseAdmin
if (!is_null($current_storage_backend) && $current_storage_backend != '') { if (!is_null($current_storage_backend) && $current_storage_backend != '') {
foreach ($current_storage_backend->getOptions() as $name => $info) { foreach ($current_storage_backend->getOptions() as $name => $info) {
$type = $info[0]; $type = $info[0];
// Backward compatibilty with yesno field description
if ($type == 'yesno') {
$type = 'checkbox';
// Remove translated labels Yes No from field info
unset($info[4]);
}
$info[0] = $storage_form_prefix . '_' . $name; $info[0] = $storage_form_prefix . '_' . $name;
$info['type'] = $type; $info['type'] = $type;
$info['field'] = 'field_' . $type . '.tpl'; $info['field'] = 'field_' . $type . '.tpl';