mardi 4 novembre 2014

Views exposed filter on node language, used on 2 different sites, with a different language list


Vote count:

0




my problem :


I've a drupal website used for 2 sites (drupal multi-site). These 2 sites are using 2 different databases, and the most important, has different languages. One with "french, english, german, italian, ...", one with "english" only.


I've created a views to manage a content type, and exposed a filter forms containing a node language filter.


enter image description here


The problem is when you export the views and use it in another website using a different language list, the default value is get from the view definition (it's done in views_handler_filter_in_operator, in the value_form(&$form, &$form_state) function, with an array_shift on the values) The problem is the values are hardcoded, it's not something which says "list all the available languages". When I use this view on the second website (with the english language by default), the default value "french", is used (cause the views definition) and the value is refused, causing an error.


enter image description here


How could I create another views filter handler to not have a hardcoded list of values, but an automatic list getting their values from the current available languages.


Here is an extract of the view export :



$handler->display->display_options['filters']['language']['value'] = array(
'fr' => 'fr',
'en' => 'en',
'de' => 'de',
'it' => 'it',
'es' => 'es',
'nl' => 'nl',


);


Many thanks for your help, it's a bit long and complex to explain :D



asked 1 min ago







Views exposed filter on node language, used on 2 different sites, with a different language list

Aucun commentaire:

Enregistrer un commentaire