Pods: 'Taggable' parameter not work fine

Created on 28 Jul 2019  路  1Comment  路  Source: pods-framework/pods

Setting the "Taggable" parameter within a Pods field has no effect. It always appears as "Taggable" without the option to disable it.

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'Edit a Pod'
  2. Click on one of the 'select' fields
  3. Within the field options, click on the "Additional field options" tab
    4 .Uncheck the 'Tagtable' checkbox option, unchecking this option should not allow adding new values to the "Select2 tag type"
  4. Returning to the interface where this field is shown, we observe the error: Select2 continues to allow new values to be added.

Expected behavior
The desired behavior should be that if we activate the "Taggable" checkbox it would allow adding new elements and if we deactivate it, it would not allow adding new elements.

Screenshots
imagen
imagen

Pods Version

I'm testing this in Pods 2.7.14

WordPress Environment



WordPress Version: 5.2.2
PHP Version: 7.3.6
MySQL Version: 5.5.5
Server Software: nginx/1.17.0
Your User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0
Session Save Path: /mnt/files/sessions
Session Save Path Exists: Yes
Session Save Path Writeable: Yes
Session Max Lifetime: 1440
Opcode Cache:
Apc: No
Memcached: No
OPcache: Yes
Redis: No
Object Cache:
APC: No
APCu: Yes
Memcache: No
Memcached: Yes
Redis: Yes
WPDB Prefix: wp_
WP Multisite Mode: No
WP Memory Limit: 256M
Pods Network-Wide Activated: No
Pods Install Location: /var/www/html/wp-content/plugins/pods/
Pods Tableless Mode Activated: No
Pods Light Mode Activated: No
Currently Active Plugins:
Pods - Custom Content Types and Fields: 2.7.14
Yoast SEO: 11.7

Additional context
The problem occurs because the value that is saved from the input is "0" a string, and the fieldConfig.pick_taggable attribute expects to receive a Boolean.

Possible Workaround
I have solved the problem by forcing the string to be converted to the corresponding Boolean. For example, I convert the string "0" to the Boolean true and the string "1" to the Boolean false in the file: pods/ui/js/pods-dfv/_src/pick/views/select-views.js (line 347):

if ( fieldConfig.pick_taggable === '1' ) {
    fieldConfig.pick_taggable = true;
} else {
    fieldConfig.pick_taggable = false;
}

But I think it is a bad solution since this problem should affect all the settings of type "checkbox" whose values should be Boolean.

I am not an expert in the Pods code and that is why I have not been able to send you a PR
I hope someone skilled can fix the problem or help me with it.

Thank you

Bug

Most helpful comment

Issue-Label Bot is automatically applying the label Type: Bug to this issue, with a confidence of 0.96. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

>All comments

Issue-Label Bot is automatically applying the label Type: Bug to this issue, with a confidence of 0.96. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

Was this page helpful?
0 / 5 - 0 ratings