backdrop-contrib / views_bootstrap

This module provides a set of styles for the Views module. It allows you to create responsive Bootstrap 3.x components, such as grids, carousels, tabs, and tables, all within the configuration settings of the powerful Views module.
https://backdropcms.org/project/views_bootstrap
GNU General Public License v2.0
0 stars 7 forks source link

Tabs not showing correct text/label #5

Closed stpaultim closed 6 years ago

stpaultim commented 6 years ago

I'm trying to use the Views Bootstrap module to show my results in tabs.

I am trying to use a text field as the label for the each tab, the text field I want to use is a select list. My selection is not showing up as I would expect in the tab. Instead, I'm seeing the word "array" in each tab (see image).

We tested another field that was not a select list to see if this problem was only for select lists. But, it did not work with a simple text field either.

fourth_street_housing_co-op___riverton

stpaultim commented 6 years ago

Note: My colleague is currently working on a pull request to fix this. We currently have a fix that works for us, but we would like to make our fix work better for more common use cases.

Radcliffe commented 6 years ago

In our case, the tab label as received by the template is an array instead of a string. It looks like this:

$tab == array(array('value' => 'ST'))

My pull request replaces the value of $tabwith $tab[0]['value'] in the case that $tab is an array. This solves our immediate problem. But I don't know why the template is receiving the wrong value, and I'm not sure that the template is the right place to fix the problem.

Also, we would prefer the tab label to match the label for the selected item, not the key. For example, our room field has the following allowed values.

ST|Studio
1B|1 Bedroom
2B|2 Bedroom
3B|3 Bedroom
4B|4 Bedroom
5B|5 Bedroom

After my fix, the tab labels are ST, 1B, 2B, etc. But they should be Studio, 1 Bedroom, 2 Bedroom, etc. How can we achieve this?

We are running Backdrop version 1.10.0 with Views Bootstrap v1.1.0 and PHP v5.5.9.

Radcliffe commented 6 years ago

Fixed.