Thanks, useful module

The module works correctly but drupal shows warnings when the module is used.

My version of Drupal is 8.3.4 with two views jump menus in a same view.

Notice: Undefined property: Drupal\views\ViewExecutable::$row_index en Drupal\views\Plugin\views\field\FieldPluginBase->getRenderTokens() (línea 1627 de /var/www/domain.dev/core/modules/views/src/Plugin/views/field/FieldPluginBase.php) #0 /var/www/domain.dev/core/includes/bootstrap.inc(566): _drupal_error_handler_real(8, 'Undefined prope...', '/var/www/tabiqu...', 1627, Array).....

Comments

Chismen created an issue. See original summary.

jalpesh’s picture

I have try with same version of Drupal and view but not able to reproduce the issue.

Can you please share some more details or steps for issue.

Thanks.

chismen’s picture

My configuration: PHP Versión 7.0.18, Apache/2.4.18, Mysql 5.7.18

1- I have created a view with a list of taxonomy,
2- select in format jump menu
3 - add two fields: taxonomy name and taxonomy ID
4 - In jump menu settings: Label field = Taxonomy term Name / Field URL = Taxonomy term ID
5- In field Taxonomy term ID rewrite field and I write /taxonomy/term/{{ tid }}

I think the problem could be called url...

Thanks

jalpesh’s picture

As per my analysis, It's look like it is happening only when we add token in field result.

chismen’s picture

solved !!!

I have copied views-jump-menu.html.twig in my theme and I have edited

<option data-url="{{ option.url }}">{{ option.label }}</option>
to
<option data-url="/taxonomy/term/{{ option.url }}">{{ option.label }}</option>

Now the field Taxonomy term URL is without rewrite.

Thanks jalpesh, the problem is in the token.

jalpesh’s picture

I think this is a temporary solution only for taxonomy view. Think about creating a new view of content or field with jump menu, URL of all view will be "/taxonomy/term/ and your URL field selected in view". As you have hard cored "/taxonomy/term/" in twig file, all other view jump URL has always "/taxonomy/term/" as prefix.

replicaobscura’s picture

@Chismen: It seems like you've selected the TID instead of the term's path or URL for the "URL field" option of the jump menu. You should add a new field to your view that contains the URL for the taxonomy term, and select that for the URL field instead. That way, you won't need to adjust the template and it'll work generically no matter what entities you are trying to link to.

replicaobscura’s picture

Assigned: chismen » Unassigned

Is anyone able to reproduce this issue still when using a valid URI/URL for the URL field? I'll leave open for now just in case.

rubberband’s picture

For the project I'm currently working on I can't get around the fact that I need to use tokens to generate the links. The following patch is a quick and dirty fix that basically just sets $view->row_index in the views_jump_menu_preprocess_views_jump_menu() hook.

hydra’s picture

Status: Active » Reviewed & tested by the community

The patch works fine, thx for sharing

jpoesen’s picture

Confirming the patch in #9 seems to work fine. Thanks!

replicaobscura’s picture

Assigned: Unassigned » replicaobscura

This appears to be working for people, and I'm good with this change (unless anyone finds any reason that this is a bad practice to do).

I'll get this committed.

  • bmcclure committed b4923eb on 8.x-1.x authored by rubberband
    Issue #2892314 by rubberband, Chismen, jalpesh, Hydra, jpoesen:...
replicaobscura’s picture

Version: 8.x-1.0-beta1 » 8.x-1.x-dev
Status: Reviewed & tested by the community » Fixed

Thanks to all involved in this fix!

Status: Fixed » Closed (fixed)

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