Skip to content
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

Fix default icon #5

Merged
merged 3 commits into from
Apr 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion components/partials/markers.htm
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@
#}
{% else %}
<script>
L.Icon.Default.prototype.options.iconUrl = '{{ __SELF__.getMarkerIconUrl()|app }}';
{% if __SELF__.getMarkerIconUrl() %}
let DefaultIcon = L.icon({
iconUrl: '{{ __SELF__.getMarkerIconUrl()|media }}',
iconSize: [40,40],
});
L.Marker.prototype.options.icon = DefaultIcon;
{% endif %}

{% for marker in __SELF__.markers %}
L.marker([{{ marker.lat }}, {{ marker.lon }}])
Expand Down
2 changes: 1 addition & 1 deletion lang/en/lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
'label' => 'LeafletPro',
'description' => 'LeafletPro general settings',
'general_tab' => 'General',
'marker_icon_url' => 'Full URL of the default marker icon',
'marker_icon_url' => 'Select the icon from the mediafinder',
'resolvers_tab' => 'Resolvers',
'nominatim_url' => 'URL of Nominatim service',
'nominatim_url_comment' => 'Read more info about Nominatim service <a href="https://operations.osmfoundation.org/policies/nominatim/" target="_blank">here</a>',
Expand Down
3 changes: 1 addition & 2 deletions models/settings/fields.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ tabs:
marker_icon_url:
label: initbiz.leafletpro::lang.settings.marker_icon_url
tab: initbiz.leafletpro::lang.settings.general_tab
type: text
type: mediafinder
span: left
default: '/plugins/initbiz/leafletpro/assets/node_modules/leaflet/dist/images/marker-icon.png'
nominatim_url:
label: initbiz.leafletpro::lang.settings.nominatim_url
commentAbove: initbiz.leafletpro::lang.settings.nominatim_url_comment
Expand Down