]> git.mxchange.org Git - friendica.git/commitdiff
Remove yesno option from Storage backend
authorHypolite Petovan <hypolite@mrpetovan.com>
Thu, 6 Feb 2020 02:37:32 +0000 (21:37 -0500)
committerHypolite Petovan <hypolite@mrpetovan.com>
Thu, 6 Feb 2020 02:37:32 +0000 (21:37 -0500)
doc/AddonStorageBackend.md
src/Model/Storage/IStorage.php
src/Module/Admin/Site.php

index 3e3a2aabae19700210671ee399684ac526ecab05..950a2ad88d9dd6ab26a8f961106c635f61bc41ef 100644 (file)
@@ -73,7 +73,6 @@ Optional. Depends on which 'type' this option is:
 - 'select': array `[ value => label ]` of choices
 - 'intcheckbox': value of input element
 - 'select_raw': prebuild html string of `<option >` tags
-- 'yesno': array `[ 'label no', 'label yes']`
 
 Each label should be translatable
 
index 363ca1f8351bff567c2d5415c423d08865ce2732..4c38e22075d24b77479d64e8fd6286d0992fa5e6 100644 (file)
@@ -63,7 +63,7 @@ interface IStorage
         *      'type',      // define the field used in form, and the type of data.
         *                   // one of 'checkbox', 'combobox', 'custom', 'datetime',
         *                   // 'input', 'intcheckbox', 'password', 'radio', 'richtext'
-        *                   // 'select', 'select_raw', 'textarea', 'yesno'
+        *                   // 'select', 'select_raw', 'textarea'
         *
         *      'label',     // Translatable label of the field
         *      'value',     // Current value
@@ -72,7 +72,6 @@ interface IStorage
         *                   // select: array [ value => label ] of choices
         *                   // intcheckbox: value of input element
         *                   // select_raw: prebuild html string of < option > tags
-        *                   // yesno: array [ 'label no', 'label yes']
         *    ]
         *
         * See https://github.com/friendica/friendica/wiki/Quick-Template-Guide
index 50a9c9d22e1bb41bec17e48835814a49762c7925..df6c53aee4df072f00d91730b483d9c76177291e 100644 (file)
@@ -556,6 +556,13 @@ class Site extends BaseAdmin
                if (!is_null($current_storage_backend) && $current_storage_backend != '') {
                        foreach ($current_storage_backend->getOptions() as $name => $info) {
                                $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['type'] = $type;
                                $info['field'] = 'field_' . $type . '.tpl';