The node language filter only supports listing enabled languages which works great for front-end views but can be limiting when creating administration views.

The attach patch allows for this to be changed via an option.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

esmerel’s picture

Status: Active » Needs review
dawehner’s picture

Status: Needs review » Needs work

+    $options['all_languages']['default'] = 'enabled';

This should be a boolean instead of a string.

+    // Shift the expose button above our options so the form makes more sense.
+    if (!empty($form['expose_button'])) {
+      $form['expose_button']['#weight'] = -2;
+    }
+

Can you explain why this makes more sense?

neclimdul’s picture

Status: Needs work » Needs review
FileSize
2.52 KB

Actually since its a select, an integer makes more sense.

As for the weight weirdness, sure. The reason is that the "all languages" form item makes most sense above the other options but when you try to shift the other form items down you'll end up with things ending up in weird places. I'm not sure of a better way to do this other than maybe making changes to views_handler_filter_in_operator which seems less than ideal.

Attached is a patch that addresses the bool/int issue.

crashtest_’s picture

I think that when the "All" selection is made in the dropdown, that it should populate the Language fieldset with the missing languages. It does currently work but you have to select All, update, then come back to the filter to see the change. Seems somewhat non-intuitive.

I will see if I can work out how to make it dynamic.

dawehner’s picture

So needs work?

crashtest_’s picture

Yeah, needs work. I still haven't looked at it but I will tomorrow afternoon.

dawehner’s picture

Status: Needs review » Needs work

so

crashtest_’s picture

Sooo, I did a fresh install of D6, cvs'd down the latest D6 version of views, enabled Locale, added a couple of languages, disabled one, added a couple of users, added a node, then went to create a view.

While trying to create a filter for User: Language, I get "Error: handler for users > language doesn't exist!"

I am stuck on that, recreating the view doesn't help. Do you get the same result when trying to ad "User: Language"?

Carlos Miranda Levy’s picture

Version: 6.x-2.x-dev » 7.x-3.7
Status: Needs work » Active

This problem remains.

Locale allows to define multiple languages and enable only some:
admin/config/regional/language

This is common when you want to limit the interface say to two languages, but will be having content in other languages as well.
One site may not have the resources to properly translate all of the interface and still accept content contributions in a separate language.

The content translation module allow translating content into languages that are defined (listed) on admin/config/regional/language even if they are disabled.

But the Language filter in views only allows choosing among enabled languages, forcing us to enable all languages for the interface that we want to support filtering the content by.

yingtho’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
2.87 KB

Patched it to Drupal 7 and added option to show the expose all languages or not.
Still missing the dynamic update once you change from enabled to all or vice verse.

Chris Matthews’s picture

Version: 7.x-3.7 » 7.x-3.x-dev
Status: Needs review » Needs work
Issue tags: +Needs reroll

The 5 year old patch in #10 to views_handler_filter_node_language.inc does not apply to the latest views 7.x-3.x-dev.

Checking patch modules/locale/views_handler_filter_node_language.inc...
error: while searching for:
 * @ingroup views_filter_handlers
 */
class views_handler_filter_node_language extends views_handler_filter_in_operator {
  function get_value_options() {
    if (!isset($this->value_options)) {
      $this->value_title = t('Language');

error: patch failed: modules/locale/views_handler_filter_node_language.inc:11
error: modules/locale/views_handler_filter_node_language.inc: patch does not apply
Andrew Answer’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
2.79 KB