Hi
I found code in the views/theme/theme.inc

function template_preprocess_views_view_summary(&$vars) {
...
//myoutput
echo $vars['rows'][$id]->url." == ".base_path() . $_GET['q']." || ".$vars['rows'][$id]->url." == ".base_path() . drupal_get_path_alias($_GET['q']);
echo "\n";

    if ($vars['rows'][$id]->url == base_path() . $_GET['q'] || $vars['rows'][$id]->url == base_path() . drupal_get_path_alias($_GET['q'])) {
      $vars['row_classes'][$id] = 'active';
    }
}

It's add active class to current element

But! if i use i18n path prefix like base_path().'/en' or base_path().'/es'
//myoutput

/en/patient-resources/glossary/a == /patient-resources/glossary/a || /en/patient-resources/glossary/a == /patient-resources/glossary/a
/en/patient-resources/glossary/b == /patient-resources/glossary/a || /en/patient-resources/glossary/b == /patient-resources/glossary/a
/en/patient-resources/glossary/c == /patient-resources/glossary/a || /en/patient-resources/glossary/c == /patient-resources/glossary/a

This code don't work!

If I use non ascii symbols like Ц then $_GET['q'] = '%D1%86'
and this code don't work too!

It have any solution?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dawehner’s picture

Project: Views (for Drupal 7) » Internationalization
Version: 7.x-3.0-beta3 » 7.x-1.x-dev

Move to i18n

webflo’s picture

Project: Internationalization » Views (for Drupal 7)
Version: 7.x-1.x-dev » 7.x-3.x-dev
Status: Active » Needs review
FileSize
2.2 KB

I think this has nothing to do i18n. base_path() . $_GET['q'] is just not reliable. Because every module can hook into hook_url_outbound_alter. I think we should always use url().

Moving back to views.

merlinofchaos’s picture

Status: Needs review » Needs work

Oh! Let's not use in_array if we can avoid it. We can set those as array keys then we can just directly test empty $active_paths[$path] or whatever the variables are named.

dawehner’s picture

Additiona the patch doesn't apply anymore.

dawehner’s picture

Status: Needs work » Needs review
FileSize
2.17 KB

Here is a new patch which uses isset instead of array_search.

dawehner’s picture

maxdev’s picture

Hi! I dont know how to make patch, but I solved this problem for D6 and Views 2.12 by using this patch manually.

webflo’s picture

Status: Needs review » Reviewed & tested by the community

Patch still applies. Looks good.

dawehner’s picture

Version: 7.x-3.x-dev » 6.x-3.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

Thanks for the review! Commited to 7.x-3.x, this probably needs a backport to 6.x

Anonymous’s picture

This definitely needs a backport to the 6.x branch. Subscribing.

dawehner’s picture

If you need a backport please don't subscribe but help out.

pawel_r’s picture

Working patch against Views 6.x-2.16 [file theme/theme.inc changed].
This is basically what has been done in #5 but in array options for url() argument 'language' is passed not 'prefix'.

Write down if there are some problems with it.

Chris Matthews’s picture

Issue summary: View changes
Status: Patch (to be ported) » Closed (outdated)

The Drupal 6 branch is no longer supported, please check with the D6LTS project if you need further support. For more information as to why this issue was closed, please see issue #3030347: Plan to clean process issue queue