Hi,
Attached a port of Geofield to D8, including the submodule Geofield Map.
It would be really great if one of the maintainers could create an 8.x-1.x branch put the attached source in it and perhaps create an alpha release. A project page with a shiny 8.x badge on it shows we're really serious about maps and D8 at the same time!
Note that I've also ported geoPHP, which was trivial. Only had to change the .info file to .info.yml! See http://drupal.org/node/1956004
I have also ported Leaflet to D8 and the two work together well.
There's only one little niggling issue: for some reason the Geofield data is not available in the Views raw results data structure. However it IS available in the Views RENDERED results. So I have enhanced the D8 code to accept either. If the data IS in the normal place it will take it from there. If for some reason it isn't, it will talke the data from the rendered Views results.
So if this issue gets fixed in a later release of Geofield and/or Views, the code will continue to work without the user having to change anything.
Attached "git commit" report to show all change/added/deleted files and the complete new D8 source, including the .git subdirectory.
I don't have an up-to-date patch file, but since this would be the start of a new branch it doesn't really mater.
Enjoy D8!
Rik
Comment | File | Size | Author |
---|---|---|---|
#12 | geofield-formatter_fix-1957760-12.patch | 1.46 KB | vdsh |
#10 | geofield-annotations_fixes-1957760-10.patch | 851 bytes | Jean-Philippe Bousselin |
#7 | Geofield-D8Port-1957760-7.patch | 18.62 KB | RdeBoer |
#7 | geofield.tgz | 495.32 KB | RdeBoer |
geofield.tgz | 470.73 KB | RdeBoer |
Comments
Comment #1
Brandonian CreditAttribution: Brandonian commentedHey Rik!
So, I've also started working on some 8.x ports to geofield/geophp. I've been working off D.O to play with some architectural changes that I want to introduce to 8.x. Any chance I can get you to do a pull request there? Otherwise, I'll definitely take a look. It sounds like you've probably gotten a little bit farther ahead of me in terms of functionality, which is cool.
Geofield 8.x: https://github.com/fillerwriter/geofield
Geophp 8.x: https://github.com/fillerwriter/geoPHP-module
Comment #2
RdeBoerHi Brandon,
Silly me... should have asked first if someone had already started on this... I looked on the project page and saw little activity, but didn't think that the activity might be going on elsewhere...
Anyway, I don't think all of my work is wasted. Happy to morph my straight D7->D8 port into your fillerwriter playpen on GitHub, if that's what you're asking?
With the arrival of Symfony new files will be entering the scene, as opposed to changes to existing files, so merging yours with mine should be fairly easy. I've done the 3 Proximity plugins for Views (field, sort, filter) and also the complete Geofield Map Views interface, which it seems hasn't been done on Github yet. So that should work out nicely.
I do feel it would be great if we can very soon, e.g. after merging it all on Github, have a half-working 8.x branch working on drupal.org too, though. It just sends a great message to the Drupal community.
Rik
Comment #3
RdeBoerHi Brandon,
I've forked fillerwriter/geofield to my RikdeBoer account on GitHub.
Do you want me to do my pull request with respect to your fillerwriter master branch?
Is the master branch on fillerwriter/geofield the same as the Drupal.org 7.x-2.x branch?
Rik
Comment #4
RdeBoerOk, all done, Brandon!
Added my bits (in particular the Views extensions) to your fillerwriter/geofield master and initiated Pull Request on GitHub.
It's all yours!
Rik
Comment #5
Brandonian CreditAttribution: Brandonian commentedSweet! I'll keep this ticket open as a reminder to pull that code back into the d.o repo soon. I agree this should happen sooner than later.
Comment #6
RdeBoerGreat, Brandon!
Keep in mind that the geofield.tgz at the top of this issue is a functional D8 version, including the (old-style) data entry widgets, successful saving etc., so may be worth keeping at hand if you aim to flesh out the 8.x-1.x branch on D.O. based on the GitHub version.
Rik
Comment #7
RdeBoerHere's a port of Geofield post D8 core freeze.
I had to move GeofieldBackendDefault.php up a directory. I couldn't get the annotation system to scan down to the Plugin directory/namespace that file was in.
Works with the existing geoPHP 8.x-1.x without changes.
Geofield Map also works.
Attached are the complete module as well as the patch file.
A few red herrings, like lat/lon having to be reversed for WKT POINTs.
The Proxomity field doesn't show in Views. Not sure why.
Comment #8
Brandonian CreditAttribution: Brandonian commentedCommitted patch in #7. Thanks, @RdeBoer!
http://drupalcode.org/project/geofield.git/commit/f6858a7
Comment #8.0
Brandonian CreditAttribution: Brandonian commentedAdded note on 8.x release
Comment #10
Jean-Philippe Bousselin CreditAttribution: Jean-Philippe Bousselin at UEBERBIT GmbH commentedHi guys, there is an issue with GeoConstraint because the annotation should now be "Constraint" and not "Plugin". Here's the patch!
Comment #11
vdsh CreditAttribution: vdsh commentedComment #12
vdsh CreditAttribution: vdsh commentedIssue in the administration with FieldFormatter incorrectly set (issues with $options and $formOptions) preventing from choosing the display option
Comment #13
alarcombe CreditAttribution: alarcombe as a volunteer commentedCan confirm patch #10 works (https://www.drupal.org/node/1957760#comment-10124388) and is required for geofield to work correctly.
Comment #14
ExTexan CreditAttribution: ExTexan commentedI've applied patches #10 and #12 to the dev branch, but I still get the "GeoType plugin does not exist" error. I realize that's not what this issue is about, but https://www.drupal.org/node/2535450 is flagged as a duplicate and refers everyone to this issue.
I'm actually a bit confused about comment #13. The #10 patch is only changing comments, not actual code, so how could that be required for geofield to work correctly?
In any case, does anyone know if a patch exists for the "GeoType plugin does not exist" error? I get it whenever I populate the lat/long fields and try to save the node.
Comment #15
kpv CreditAttribution: kpv commentedActually it's not just a "comment" but part of plugin annotation which is used in plugin discovery process.
Comment #16
alarcombe CreditAttribution: alarcombe as a volunteer commented@ExTexan - @kpv is right, those comments are used by Drupal's plugin mechanism to detect and cache the various plugins. The change in comment 13 is because the name of the verification plugin types changed in core. This is why you cannot save the contents of a geofield without that patch, as verification fails.
I found that in order to get geofield working you need the following:
latest HEAD of geofield
latest HEAD of geophp enables creation of field and saving settings.
This patch for geofield https://www.drupal.org/files/issues/geofield-annotations_fixes-1957760-1...
This patch for geofield https://www.drupal.org/files/issues/geofield-formatter_fix-1957760-12.patch
This patch for geofield https://www.drupal.org/files/issues/geofield-geolocation-fix-2573983-1.p...
This patch for geophp https://www.drupal.org/files/issues/geophp-add_getadaptermap_method-2463...
This patch for geophp https://www.drupal.org/files/issues/geophp-safemarkup.patch
Comment #17
ExTexan CreditAttribution: ExTexan commentedExcellent! Thanks for the detailed reply.
I'll give that a try.
Comment #18
pmackay CreditAttribution: pmackay commentedMay I ask, what's the current state of geocoding from another field? Might it be useful to list in the summary what parts of D7 geofield are supported in D8 version?
Comment #21
plopescHello all.
I already committed all the patches listed in #16. Could someone take a look to confirm all the things are working now?
Thanks!
Comment #22
juliencarnot CreditAttribution: juliencarnot commentedHi all,
Regarding plopesc's last question, I just installed Geofield 8.x-1.x-dev from 2015-Nov-23 with PHPgeo version 8.x-1.0-beta1 from 2014-Oct-28 on my D8 install. Geofield seems to install correctly, but I get a blank page when saving the changes after adding a geofield lat/long field to a content type, with this error:
PHP Fatal error: Call to undefined method Drupal\\geophp\\GeoPHPWrapper::load() in /[...]/modules/geofield/src/Plugin/Field/FieldType/GeofieldItem.php on line 206, referer: /[...]/admin/structure/types/manage/ressource/fields/node.ressource.field_geofield?destinations%5B0%5D%5Broute_name%5D=entity.node.field_ui_fields&destinations%5B0%5D%5Broute_parameters%5D%5Bfield_config%5D=node.ressource.field_geofield&destinations%5B0%5D%5Broute_parameters%5D%5Bnode_type%5D=ressource&destinations%5B1%5D=/[...]/admin/structure/types/manage/ressource/fields/add-field
When I go back to the field list (/admin/structure/types/manage//fields), the field has been added. The next tab (form-display) seems to work fine, but the "display" tab gives me another blank page:
PHP Fatal error: Call to undefined method Drupal\\geophp\\GeoPHPWrapper::getAdapterMap() in /[...]/modules/geofield/src/Plugin/Field/FieldFormatter/GeofieldDefaultFormatter.php on line 59, referer: /[...]/admin/structure/types/manage/ressource/form-display
Hope this helps, and thanks to all the contributors so far!
Comment #23
balagan CreditAttribution: balagan as a volunteer commentedI am using the 8.x-1.x branch (also Nov. 23). Everything is working fine, I can add geofield to content type with no problem. Only when I create a content of that type, I get the "The "GeoType" plugin does not exist." error.
Comment #24
scottholmes CreditAttribution: scottholmes commentedI have several content types in a Drupal 7 site that contain geofields. These were not recognized by drupal's migration to drupal 8 modules. I don't know if this is a problem of much significance at this point to geofield's porting efforts. I have not tried entering data manually and I don't know if this is something I need to tweak in using migration.
Comment #25
sillygwailojuliencarnot: what happens if you use the dev branch of the geoPHP module? I encountered the first error you mention. Then I updated to the latest dev version of geoPHP (not GeoField), and was able to add content.
Comment #26
juliencarnot CreditAttribution: juliencarnot commentedsillygwailo: Sorry, I moved to Geolocation field for now and don't have enough time to test this on a clean environment, but I guess your suggestion would solve my initial problem!
Comment #27
gdelver@xs4all.nl CreditAttribution: gdelver@xs4all.nl as a volunteer commentedHi, I am testing geofield with address and geocoder and leaflet. I got the adsress with geocoding working (nice and thanks!). Leaflet produces a blanc screen when i add it to the display format (leaflet map) of the geofield. I tried the 8.x-1.0-alpha1 and the 8.x-1.x-dev versions. Both produce the same problem. For the geofield I use 8.x-1.0-alpha2. I use the leaflet Leaflet 1.0.0-rc1 library and put it in sites/all/libraries/leaflet as indicated. So where do I go wrong? I read that that work well together. Any advise will be appreciated greatly. Guido.
Comment #28
FMB CreditAttribution: FMB commentedpmackay: you'll need the Geocoder module in order to geocode from another field.
Comment #29
gdelver@xs4all.nl CreditAttribution: gdelver@xs4all.nl as a volunteer commented@FMB: I have a full set working now in production for some time with geofield, geocoder, address field and leaflet including the leaflet more maps. Works fine. I am eager to use e.g. some of the input features that have not been converted yet leaflet input widget. It turns out that not all of the features have been moved to d8 in both geofield and leeaflet...
Comment #30
FMB CreditAttribution: FMB commentedgdelver@xs4all.nl: regarding Leaflet Widget, see #2654864: Port to Drupal 8 and https://github.com/bforchhammer/leaflet_widget, which works although it does not seem to be currently maintained, and it is obviously not on drupal.org.
Comment #31
gdelver@xs4all.nl CreditAttribution: gdelver@xs4all.nl as a volunteer commented@FMB, thanks for the tip. I will give it a try asap and report back.
Comment #32
vitaliych CreditAttribution: vitaliych commented@gdelver@xs4all.nl could you please explain me how you made that work for you step - by step
i'm trying to make it worked address module for D8 plus geofield+geocoder+geocoder address+leaflet
all steps
1 installation
2 configuration
There are no Documentation for D8 at the moment
Regards
Comment #33
itamair CreditAttribution: itamair as a volunteer commented