Problem/Motivation

After updating the Flag module to 8.x-4.0-beta6, this module is not integrating with well with views. Pages displaying views with an indexed Search API flag field are throwing a fatal error:

Symfony\Component\Routing\Exception\InvalidParameterException: Parameter "view_mode" for route "flag.action_link_unflag" must match "[^/]++" ("" given) to generate a corresponding URL. in Drupal\Core\Routing\UrlGenerator->doGenerate() (line 209 of core/lib/Drupal/Core/Routing/UrlGenerator.php).

Could this be due to the change https://www.drupal.org/node/3458551?

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

jonraedeke created an issue. See original summary.

joco_sp made their first commit to this issue’s fork.

joco_sp’s picture

Priority: Normal » Critical
Status: Active » Needs review

Escalating to Critical, because it breaks the website.

jonraedeke’s picture

Status: Needs review » Reviewed & tested by the community

Thank you for the quick fix Aljoša! It works well and diff looks good. RTBC

hatsch’s picture

confirm that this fixes problems with Flag 8.x-4.0-beta6. RTBC

bsingh’s picture

Thanks @joco_sp

liquidcms’s picture

I have this error without Flag Search API, so wonder if the fix should be here or in the Flag module?

liquidcms’s picture

Nope, my bad. i have custom code (likely like this module does) that calls Flag link building service.. which they changed API for in beta6. "view mode" is no longer option parameter to pass. Still likely a bug in Flag as it has $view_mode = NULL in call to LinkBuilder method and it should likely be $view_mode = 'default'.