Integration feature for geofield.

  1. Complete shallow porting of openlayers_geofield 3.1.x to leaflet_geofield 7.x-2.x
  2. create plugin structure code Leaflet Layer, GeofieldMarkerLayer
  3. create plugin settings form for Leaflet Layer, GeofieldMarkerLayer
  4. create plugin structure code for Leaflet Icon
  5. create plugin settings form for Leaflet Icon
  6. create plugin structure code for Leaflet Popup
  7. create plugin settings form for Leaflet Popup
  8. update plugin settings for Leaflet Layer including settings of Leaflet Icon and Leaflet Popup
  9. complete Leaflet Layer js script
  10. complete Leaflet Icon js script
  11. complete Leaflet Popup js script
  12. bugfixing
  13. 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

chriscalip’s picture

Issue summary: View changes
chriscalip’s picture

Issue summary: View changes
chriscalip’s picture

Title: Geofield Display » 7.x-2.x Geofield Display
chriscalip’s picture

Issue summary: View changes
chriscalip’s picture

Issue summary: View changes
chriscalip’s picture

Assigned: Unassigned » chriscalip
chriscalip’s picture

Title: 7.x-2.x Geofield Display » 7.x-2.x Geofield Display Formatter
chriscalip’s picture

Issue summary: View changes
chriscalip’s picture

development 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

chriscalip’s picture

Initial 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

chriscalip’s picture

Interesting 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?
,

chriscalip’s picture

Follow-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..

Pol’s picture

Yes check Object.php line 227, method getOption, the first parameter can be an array.

Examples:

$object->getOption('option1');
// This will retrieve: $object->options['option1'];

$object->getOption(array('option1'));
// This will retrieve: $object->options['option1']

$object->getOption(array('option1', 'option2', 'option3'));
// This will retrieve: $object->options['option1']['option2']['option3'];
chriscalip’s picture

cool thanks, updating plugin optionsForm to have fieldsets

chriscalip’s picture

Reference :

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..

chriscalip’s picture

Decided 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

chriscalip’s picture

chriscalip’s picture

chriscalip’s picture

Issue summary: View changes
Pol’s picture

Hello 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.

chriscalip’s picture

Hi 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