Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The interpretation of the error was wrong - se #2 for details.
Have changed the taxonomy but keept the filter. When I now have the same term name the filter sets the default to the old TID (one thats not in use anymore) instead of the terms new TID.
This result in all cases are false in a mandatory filter.
Where is the default TID value stored? I think its might just be to change it in the database.
Comments
Comment #1
RdeBoerHi laghalt,
You can set global filter defaults on the global filter block configuration page, for instance, here: admin/structure/block/manage/global_filter/global_filter_1
Or perhaps you stored the default on your user profile and forgot?
Defaults are be stored in one of three places. You select which of the three here: admin/config/development/session_cache
Rik
Comment #2
laghalt CreditAttribution: laghalt commentedLooking more in to it - I seem to be wrong in my teory of why I get a value of 3 or 2 as default (when the TIDs are 29 and 30).
in
$glf_customer = global_filter_get_session_value('customertype');
I used $glf_customer[0] as the value.
Instead it seems like the value is in $glf_customer when a default is loaded and the $glf_customer turns into a array when the visitor choses a value.
I solved this with this code:
Quite a dirty solotion
Comment #3
RdeBoerHi laghalt,
Didn't realise you were retrieve the global filter value through code.
Yeah, if the taxonomy is set up to be multi-select I believe you get an array back from
global_filter_get_session_value()
.If that's "dirty" then blame core. The Session Cache API used by Views Global Filter simply stores and retrieves the way as it receives them -- like it should.
Rik
Comment #4
laghalt CreditAttribution: laghalt commentedOh, thanks. In fact its a singleselect - but I think its the same to the core. I impressed that the viewfilter manage to handle the difference, working on a module I didn realy like the fact that the data was so diverse. So I change the default into an array - dont know if I break anything.
I did like this in a function that the visitor triggers first:
Or - with a little more style (keeping the array in present function):
Comment #5
laghalt CreditAttribution: laghalt commentedHave change the title to a more corect one
Comment #6
laghalt CreditAttribution: laghalt commentedComment #7
laghalt CreditAttribution: laghalt commentedIm closing it -
one can use my fix.
Comment #8
laghalt CreditAttribution: laghalt commentedComment #9
laghalt CreditAttribution: laghalt commentedComment #10
laghalt CreditAttribution: laghalt commented