I'm trying to understand how to add a token so that I can use a particular pin icon for a particular entity bundle in a view.

I have the following configured but I don't think I'm getting the token to work. The entity type is added as a (hidden) field - as further below but I don't know exactly what to type in the field to use it?

this is the field I want to add

what should I put here?

Comments

rachel_norfolk created an issue. See original summary.

rachel_norfolk’s picture

After a lot of digging through code, I'm now beginning to think this is only read once per view? And that the only current way to get an icon on to the marker is via adding an icon image field? What if I want to store the images somewhere in the theme, for instance? And supply a path to the icon via a text field?

christianadamski’s picture

Status: Active » Needs review
StatusFileSize
new1.94 KB

1.) View token replacement
2.) File path creation
3.) On fail, try Url::fromUri

Locally works fine.

arnaud-brugnon’s picture

Great, it works for me !

thedut’s picture

Status: Needs review » Reviewed & tested by the community

Hello
The patch solve this issue for me to, and it a great feature.

  • ChristianAdamski committed 3270aea on 8.x-1.x
    Issue #2869017 by ChristianAdamski, rachel_norfolk: How to use the token...
christianadamski’s picture

Status: Reviewed & tested by the community » Fixed

Pushed with minor alterations.

Status: Fixed » Closed (fixed)

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

sneo’s picture

Hi,
Not working for me.
Missing $row_number for find the good token.
I add the row number to the line 205

foreach ($this->view->result as $row) {
foreach ($this->view->result as $row_number=>$row) {

Works like a charm now, thx, but could it be in the next release ? Hate to patch :)
I'm on version: '8.x-1.10' of geolocation.

Thx all

christianadamski’s picture

@spiderneo,

this is already in -dev release

arnaud-brugnon’s picture

And what about stable release ?

spacetaxi’s picture

I've been struggling to use the token, and realized that this patch is geared specifically for tokens that have a URI that are then turned into a url through file_create_url. I think that this patch is actually more restrictive then just processing the tokens, which I think is what the original request was for. And, for whatever reason, I have had problems getting my view to even produce a URI for an image in my content type.

I'd suggest this change:

$icon_token_url = $this->viewsTokenReplace($this->options['google_map_settings']['marker_icon_path'], $this->rowTokens[$row_number]);
// $icon_token_url = file_create_url($icon_token_uri);

rituraj.gupta’s picture

Component: Google Maps geolocation » Geolocation Field / Backend
StatusFileSize
new109.54 KB

Hello,

Can anyone can make google map as in attached screenshot?

Regards,
Ritu Raj