The usage of the FaqHelper::arg() function causes the FAQ module to misbehave on multilingual sites where arg(0) returns the language fragment.

Usage of routeMatch is advised to replace the custom arg() function.

Replace
if (FaqHelper::arg(0) == 'faq-page') {

by
if (\Drupal::routeMatch()->getRouteName() == 'faq.faq-page') {

By using routeMatch, this should also allow for aliasing of the /faq-page path, since now this is hardcoded.

Comments

wtrv created an issue. See original summary.

wtrv’s picture

Title: Aliasing faq-page url does not work because of hardcoded path » Support multilingual sites
Issue summary: View changes
wtrv’s picture

Issue summary: View changes
sumitmadan’s picture

Issue summary: View changes

Hi,

There are a lot of places where FaqHelper::arg(0) == 'faq-page' is used, and this method is basically to check a part of the path and not the full path. So, routename will return different string on "faq-page" and "faq-page/1".

If possible, please create a new method in FaqHelper class, pass the string to search in url. like, FaqHelper::filterarg('faq-page').

  • sumitmadan committed e3b2043 on 8.x-1.x
    Issue #2658152 by wtrv, sumitmadan: Support multilingual sites
    
sumitmadan’s picture

Status: Active » Fixed

Make it workable with different languages. Committed to 8.x-1.x. Thanks.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.