Hi everyone,

I have a leaflet view and I'd like to use tokens to fill the vector display options. I have a field containing the fillColor I'd like to use.
But this is not working, the token is not replaced by its value...

Anyone could tell me if they achieve to make this work ?

Thanks

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

hennakamra’s picture

Issue summary: View changes
FileSize
2.53 KB

Hi
I had the same requirement and created a patch to get it working.
(this is my first patch. Hope this will work for you.)

hennakamra’s picture

Issue summary: View changes
hennakamra’s picture

indivar’s picture

Status: Active » Needs review
robertwb’s picture

Category: Support request » Feature request

Interesting. Changing this to "Feature Request" since I think there was no Token support prior? If there was token support then maybe we should change this to a bug :)

robertwb’s picture

A sample use case with a screen capture would be really cool here -- @hennakamra you got the time for that?

RdeBoer’s picture

Waiting for more people to confirm this patch before committing.

@hennakamra: thanks so much for the patch; can you please do one that better adheres to Drupal coding standards, in particular use 2-space indentation (no tabs)

Rik

hennakamra’s picture

Hi Rik

I pulled the latest dev version (on a clean drupal setup) to create the new patch but my view keeps breaking.
Problem occurs when I select '<node entity>' for 'Description Content' in style settings (Format: Leaflet)
The 'View Mode' dropdown list comes empty, and when I save the view and visit the view page, I just get white screen

Notice: Undefined property: leaflet_views_plugin_style::$entity_info in leaflet_views_plugin_style->render() (line 275 of /var/www/drupal22/sites/all/modules/leaflet/leaflet_views/leaflet_views_plugin_style.inc).

Can you please take a look at this. Should I create a new issue along with steps to recreate this problem?

RdeBoer’s picture

Hi hennakamra,
I'll have a look tomorrow and will get back to you.
Rik

hennakamra’s picture

Hi Rik

Fixed the white screen - broken views issue with this patch.

  • RdeBoer committed 03db32b on 7.x-1.x authored by hennakamra
    Issue #2378113 by hennakamra: Tokens in views don't work (patch I)
    
RdeBoer’s picture

Thanks hennakamra,
Patch applied.
Rik

hennakamra’s picture

Here's the new patch to fix the token replacement in 'vector display' options

RdeBoer’s picture

Thanks hennakamra,
I changed your patch a little as there were 3 consecutive checks for is_object($result).
I reduced it to 1. Hope I didn't make a mistake!
I don't have a test rig handy, so can you please check?
Rik

  • RdeBoer committed 4fbcea3 on 7.x-1.x authored by hennakamra
    Issue #2378113 by hennakamra: Tokens in views don't work (patch from...
hennakamra’s picture

Hi Rik
Thanks for fixing it. Its working fine for me.

RdeBoer’s picture

Cool. Then that's another reason to make a new official release soon.
Rik

NedimTingea’s picture

I am getting an error when applying the patch:

File to patch: /cygdrive/c/15_LEAFLET_DRUPAL/leaflet/leaflet_views/leaflet_views_plugin_style.inc
checking file /cygdrive/c/15_LEAFLET_DRUPAL/leaflet/leaflet_views/leaflet_views_plugin_style.inc
Hunk #1 FAILED at 273.
1 out of 1 hunk FAILED

Any insight?

RdeBoer’s picture

@NedimTingea:

See system comment #15: the patch is already in the repository and therefore automatically available in Leaflet 7.x-1.x-dev which you download from the bottom of the project page.
No need to try and patching it again.

Rik

NedimTingea’s picture

@RdeBoer

Thanks, I will try updating to the Leaflet 7.x-1.x-dev and post feedback.

NedimTingea’s picture

FileSize
33.34 KB
36.64 KB

Hello again,

I updated Leaflet to 7.x-1.1+39-dev.

This is exactly what i am trying to do:

- I have a View with all road constructions together.
- I add a road construction and put a Color of it in a Text Feld (Boja) (see attached picture).
- I put this field as a token in the leaflet view (see attached screenshot) to color lines differently based on a token.
- It does not show the color of a line i put in the text field but shows the default blue color for every line.
- When i insert a normal color like #000 (black), every line shows as black.

Do you have any ideas on what might be wrong?

hennakamra’s picture

FileSize
53.47 KB

Hi NedimTingea,

Have you assigned any field to 'Title Field' in Leaflet settings (see attached screenshot). I can recreate your issue on fresh installation if I leave the Title field blank. Can you please try assigning the Title field and see if this solves your problem.

Thanks

NedimTingea’s picture

FileSize
34.08 KB
33.8 KB

Hello hennakamra,

Yes a Title Field is assigned (see screenshots) but now as you mentioned i realized that it it does not show on the map.
When i set the 'Title Field' and don't set the 'Description Content' the line is clickable but nothing shows up. A popup only shows if i set the 'Description Content', again with no title. Maybe this is also interfering with the tokens in 'Line Color'??

Thank you for your help in this issue.

hennakamra’s picture

FileSize
113.85 KB
76.46 KB
51.37 KB
64.72 KB

Hi NedimTingea

Yes you are right, Polygons only display the description content in the popup. But I don't think it is affecting the token replacement.

I recreated the leaflet view and the color token is still working for me. (Please see attached screenshots).

If you have time, can you please try to recreate this issue again on fresh installation (to check if the issue is because of any confliction with other modules)

Thanks

NedimTingea’s picture

I will try more things out, could you test it on lines at your end, because i am using lines and not polygons.

Thanks

hennakamra’s picture

FileSize
88.85 KB

Working with lines too.

RdeBoer’s picture

Status: Needs review » Closed (fixed)

Closing as fixed until proven otherwise.

andyanderso’s picture

I am having trouble making the tokes work in views as well. I am using the latest dev version of leaflet. Does it still need a patch? Did you ever find out what the conflict was?

aitala’s picture

Is still not working as far as I can tell....

E