Path Geometries Options in the drupal view field is not working

Created on 6 April 2023, over 1 year ago
Updated 26 April 2023, over 1 year ago

For some reason I cannot override Path Geometries Options formatter in the view formatter. Not sure is this a bug.
I have a node with Geoman used on geofield and I've made a polygon and changed settings for Path Geometries Options (color, transparency etc) on the same field (both in Manage for display and Manage display).
However when I add that field into view and set Format view to Leaflet Map, seems like Path Geometries Options in the view field is not applied/working. I can only apply Path Geometries Options in Path Geometries Options formatter in the view formatter. I need multiple styles for different fields (polygons) and guess this should be working (either to inherit Path Geometries Options from the node or apply it to Path Geometries Options field in view).

I'm using module version 10.0.8 on drupal 10.0.3

Thanks

💬 Support request
Status

Fixed

Version

10.0

Component

Code

Created by

🇷🇸Serbia ivanilic

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @ivanilic
  • Status changed to Postponed: needs info over 1 year ago
  • 🇮🇹Italy itamair

    Sorry @ivanilic you are having this troubles and difficulties, but if I say that more appropriate therminology and may be also some screenshot might help in better understanding what you explain and what you mean?
    What is a View Formatter? A Drupal View has a Display Style and Settings ...
    So as ...

    when I add that field into view and set Format view to Leaflet Map, seems like Path Geometries Options in the view field is not applied/working

    What is "Format View"? (rather View Display Style ... ) and what is the "view field"?

    Using the correct terminology, the "Path Geometries Options" appears in Leaflet settings in the following contexts:

    • Leaflet Widget
    • Leaflet Formatter
    • Leaflet View Display Style

    and each of them works and can be set differently and autonomously (using also Replacement Patterns Tokens).
    And all this works correctly, as I just tested and double checked.

    Juts get better insights and more practice/confidence with the above Leaflet settings and logics ...

  • 🇷🇸Serbia ivanilic

    Hi @itamair thanks for your support and reply,
    I must admit I wasn't clear enough, sorry about that.
    Let me try to explain more (take a look at the pic):

    I have a node (machine name: mape_opstine) and I have a geofield (field_granice_opstine) with geoman used and I've made a polygon as you can see from the picture with fillOpacity 0 and red color for polygon optons.

    I tried to make a vew (second line in the image) and set Leaflet View Display Style with adding no options for the Path Geometries Options.
    I wanted to apply Path Geometries Options only for that specific field (or inherit Path Geometries Options from the node field with red color and 0 opacity).
    Even when I fill Path Geometries Options in the field with the polygon (3rd line in the picture) it's not applied and default styles are applied.
    I want to add more fields with different polygon styles and don't want to use same style for colors etc.

    If I use Path Geometries Options in the Leaflet View Display Style and apply geometry optons from the node there (second line in the attached image) it is applied but then it's applied to all polygons and fields in the view and I want them to be different.

    I tried with different approaches and field values and Replace patterns (I have token module installed) but not figured out how to apply it for the specific field or as I said to inherit styles from the node. For some reason it's not applied and it's always using styles from the Path Geometries Options in the Leaflet View Display Style.

    I'm probably missing something if this should be working.
    Thanks again!

  • 🇮🇹Italy itamair

    @ivanilic still quite/very cryptic to me your way of explaining your use case ... (but should be a sync or commitment issue from mine).

    The only think that I got (I guess) is that you are trying to differentiate/customise each Content Path representation ...
    and well your attempts setups are not right.

    For doing so you need to:
    - define additional fields for the Content/Entity type where to store the Path/Geometries options attributes (Fill Color, Fill opacity, Stroke Color, Stroke Width, etc.) ... see the attached first image;
    - use the Replacements Patterns / Tokens placeholders referring to those fields/attributes in each Path Options Settings (both on the Leaflet Formatter or in the Leaflet View). Note: for the Leaflet View you need to add those fields among the Leaflet View Display fields ... (see the other attached images on this);

    Once you get my hints you will find your way with your customisations. This approach is very flexible and customisable ...

  • Status changed to Fixed over 1 year ago
  • Status changed to Active over 1 year ago
  • 🇷🇸Serbia ivanilic

    Hi @itamair
    I've been trying to figure out how did you create that additional field "Geometry attributes" from the first image:
    https://www.drupal.org/files/issues/2023-04-07/Screenshot%202023-04-07%2...

    Could you please explain how to replicate it,
    thanks!

  • 🇮🇹Italy itamair

    Those are normal/common/simple additional fields on the Content/Entity Type where you are using the Geofield field, so that they could become part of Tokens/Replacement Patterns (haven't you ever seen/used Tokens/Replacement Patterns, really?).
    In this case 2 of them are Number (one integer and one float) and 2 of them are List (string) types. That's it ...

  • 🇷🇸Serbia ivanilic

    Thanks, I figured it out in the meantime while I was reading your post on:
    https://www.drupal.org/project/geofield_map/issues/3084759 📌 Implementation of Replacement Patterns (tokens) to Path Geometries Options in Geofield Map Formatter & Geofield Map View Fixed

  • Status changed to Postponed: needs info over 1 year ago
  • 🇷🇸Serbia ivanilic

    Hi @itamair, you can change the status of the issue to "fixed". Everything works fine with the approach you suggested.
    Thanks again for your support.

  • 🇮🇹Italy itamair

    Nice! Happy that all this helped you!
    Don't hesitate to come back to the community with your feedbacks and contributions in general ...

  • Status changed to Fixed over 1 year ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024