Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Integration feature for geofield.
Complete shallow porting of openlayers_geofield 3.1.x to leaflet_geofield 7.x-2.xcreate plugin structure code Leaflet Layer, GeofieldMarkerLayercreate plugin settings form for Leaflet Layer, GeofieldMarkerLayer- create plugin structure code for Leaflet Icon
- create plugin settings form for Leaflet Icon
- create plugin structure code for Leaflet Popup
- create plugin settings form for Leaflet Popup
- update plugin settings for Leaflet Layer including settings of Leaflet Icon and Leaflet Popup
- complete Leaflet Layer js script
- complete Leaflet Icon js script
- complete Leaflet Popup js script
- bugfixing
- try to port as much leaflet 7.x-1.x geofield feel "defaults,design decisions" to 7.x-2.x , to maintain continuousness
Notes : for initial leaflet 2.x geofield putting vector layers as another issue.
Comments
Comment #1
chriscalip CreditAttribution: chriscalip commentedComment #2
chriscalip CreditAttribution: chriscalip commentedComment #3
chriscalip CreditAttribution: chriscalip commentedComment #4
chriscalip CreditAttribution: chriscalip commentedComment #5
chriscalip CreditAttribution: chriscalip commentedComment #6
chriscalip CreditAttribution: chriscalip commentedComment #7
chriscalip CreditAttribution: chriscalip commentedComment #8
chriscalip CreditAttribution: chriscalip commentedComment #9
chriscalip CreditAttribution: chriscalip commenteddevelopment snapshot :
added compoments plugin type now available as a setting during map instance edit.
added geofield_leaflet formatter, only shows map no markers yet. not complete.
added geofield_leaflet formatter settings form, letting admin users change map instance aka leaflet_map
added geofield_leaflet formatter summary, shows formatter settings information
Comment #10
chriscalip CreditAttribution: chriscalip commentedInitial architecture approach.
1.) Create Plugin Leaflet Layer "GeofieldMarkerLayer", with the following settings : Show Popup Settings, Select Plugin Instances of Leaflet Icon, Show Tokens. Setting's were based from leaflet 1.x settings with the exclusion of map and map height; as this layer is only concerned with it's settings ie. this layer has popup settings, select available icons, and tokens will be populating it's marker content.
It's settings is based on http://leafletjs.com/reference.html#marker
2.) Create Plugin Leaflet Icon, its settings is based on http://leafletjs.com/reference.html#icon
3.) Create defaults of leaflet layer "GeofieldMarkerLayer" and leaflet icon.
Effort should be made that wording and defaults are as close from leaflet 1.x
Comment #11
chriscalip CreditAttribution: chriscalip commentedInteresting use case for geofield formatter; important contextual information like entity type ('node') & it's bundle and with those.. awareness of the entity type's field structure (other fields).. are used by additional form fields of GeofieldMarkerLayer plugin settings, like token.. showing what values are available to be inserted in the popup marker content. Additional contextual information used in Point Icon and its derivative divIcon fields names based.
As much as I dislike removing established features from leaflet 1.x I am thinking of replacing icon divIcon as a textfield instead of a contextual select option; more likely patches will come in the future to address specific use case.
Issues to follow-up are plugin's optionForm's have ability to make use of fieldset and additional form fields be part of those fieldset? For form fields part of those fieldsets is the api call
$this->getOption('fieldPartOfFieldSet')
still use-able?,
Comment #12
chriscalip CreditAttribution: chriscalip commentedFollow-up on GeofieldMarkerLayer plugin optionsForm and trying to keep leaflet 1.x 's token feature.. the idea of just a helper form field that show's the admin the available tokens given the contextual info.. ie. if this is GeofieldMarkerLayer plugin instance is being used entity type "node" bundle "page" it show's bundle page available token like maybe field_address ..
On the UX side of things configuring leaflet map for each bundle will encounter user experience penalties (refer to point A).. but I believe the benefits of 2.x configurable plugins far outweighs initial user experience penalties (pretty possible to make inline editing for creating map instances).
point A :
Context Setup, currently geofield provides GeofieldMarkerLayer a layer plugin , also provides a default map with a GeofieldMarkerLayer layer. geofield display settings will only show options of maps with a GeofieldMarkerLayer.
Imagine site builder setting up 3 different node bundles (page,article,test-bundle) page has fieldA, fieldB, fieldC, and geofield; article has fieldD, fieldE, fieldX, geofield while test-bundle has field1, field2, geofield..
On the context of geofield setting up per bundle 1.x lets site builder go through all the options at managed display tab.
With the incoming 2.x , site builder will have to instantiate 3 different map with GeofieldMarkerLayer layer and set the approapriate GeofieldMarkerLayer layer settings and its field tokens..
Comment #13
PolYes check Object.php line 227, method getOption, the first parameter can be an array.
Examples:
Comment #14
chriscalip CreditAttribution: chriscalip commentedcool thanks, updating plugin optionsForm to have fieldsets
Comment #15
chriscalip CreditAttribution: chriscalip commentedReference :
updated GeofieldMarkerLayer plugin optionsForm, added token_help form item for ux.
http://cgit.drupalcode.org/sandbox-Pol-2399051/commit/?id=0e3c03a
form_item token_help gives a list of available tokens. token_help is also only visible if the selected option on form token_entity is not none.
Followup on this token_help , update token_help 's '#token_types' depending on the value of select option token_entity. As of this time I am not able to complete this detail function..
Comment #16
chriscalip CreditAttribution: chriscalip commentedDecided to implement a workaround for form item token_help and its '#token_types' values.. and just show all tokens by giving all entity types to token_types. Creating another issue for this particular detail.
Reference:
added workaround show all tokens for all entity types pending proper patch to filter tokens based on user selected entity type
http://cgit.drupalcode.org/sandbox-Pol-2399051/commit/?id=a4f8478
Comment #17
chriscalip CreditAttribution: chriscalip commentedComment #18
chriscalip CreditAttribution: chriscalip commentedComment #19
chriscalip CreditAttribution: chriscalip commentedComment #20
PolHello Chris,
das-peter just committed a new geofield formatter among some other good stuf for Openlayers, maybe you should have a look.
Have a nice day.
Comment #21
chriscalip CreditAttribution: chriscalip commentedHi Pol,
Nice day indeed-- quite a bit of updates in the openlayers 3.1.x branch since I last looked at jan 2, a lot of them are really useful. I understand that leaflet, and openlayers codebases has a lot of commonalities; but divergences is quite unavoidable. I'll try to port as much of the changes as possible from openlayers codebase..
Chris