I am not able to configure the leaflet in display format of the view.
When I added the leaflet in Display format I get the error "Style Leaflet requires a leaflet map to be configured drupal".
Please suggest

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pallavi_sugandhi created an issue. See original summary.

szeidler’s picture

Same problem here. Also with the current dev version at https://www.drupal.org/node/2070343.
For me it seems, as only the old leaflet map style plugin is fully implemented at the moment. When you look at leaflet_views/config/schema/leaflet_views.style.schema.yml only views.style.leafet_map is defined.

Both styles are mapped to

* @ViewsStyle(
 *   id = "leafet_map",

which creates the confusion.

So there needs to be an schema added for the Leaflet.php and the id changed in the class annotations.

Or did we misundestood the naming and we need to add a Leaflet Map (old) at first, before we can add a Leaflet style? Then it shouldn't be a `display_types = {"normal"},` and then not available when creating a view.

pvhee’s picture

Status: Active » Needs work

Only the old leaflet map style is fully implemented indeed, so the new leaflet map style still needs some work (see also https://www.drupal.org/node/2589671)/. Once completed, we can make a first beta release of the module, so patches welcome!

szeidler’s picture

What's the purpose of the new leaflet map style? Should it be used only for refactoring or will there be another feature set? And if yes, which ones?

juliencarnot’s picture

Same problem here. Does the refactoring patch at https://www.drupal.org/node/2745851 cover this issue, or are they separate?

Good questions in #4 szeidler, I was wondering the same!

alarcombe’s picture

This error was still occurring for me at commit da0386d50987b63199937163bfe438807e7affcd which was after the refactoring patch was committed. What worked for me was removing the validate() method from the Leaflet views style, as I believe it is being called too early. For me, removing this function had no direct effects on creating and using a view, but it *might* cause problems if importing a malformed view (though it's arguable that's a bit of an edge case).

alarcombe’s picture

Status: Needs work » Needs review
ckaotik’s picture

A map selection is already enforced by the form element being #required, so the validation should not be necessary.
However, because of that there should not be an error at all. What I've noticed is that the map option is only saved when the map height is changed, too. After the initial save, map height can again be set to the default value and saving still works. Might be worth investigating.