Skip to content

[Map] Enhance ux_map(), allow to create a Map directly in Twig! #2152

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

Kocal
Copy link
Member

@Kocal Kocal commented Sep 11, 2024

Q A
Bug fix? no
New feature? yes
Issues Fix #...
License MIT

A lighter alternative to #2117.

Note that this PR is not 100% complete, it's a POC, it's missing some runtime-checks and options to build a map.

With the following code:

{{ ux_map(
    center=[51.5074, 0.1278],
    fit_bounds_to_markers=true,
    zoom=10,
    markers= [
        { position: [51.5074, 0.1278], title: 'London' },
        { position: [48.8566, 2.3522], title: 'Paris' },
        {
            position: [40.7128, -74.0060], 
            title: 'New York',
            infoWindow: { content: 'Welcom to <b>New York</b>', opened: true }
        },
    ],
    attributes={
        class: 'foo',
        style: 'height: 400px; width: 100%;',
    }
) }}

I'm able to render this map:
image

WDYT @smnandre?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant