Hi
I'm trying to create a ludwig.json file for Geofield module
the module contains a composer.json file and it contains:
{
"name": "drupal/geofield",
"description": "Stores geographic and location data (points, lines, and polygons).",
"type": "drupal-module",
"homepage": "https://www.drupal.org/project/geofield",
"authors": [
{
"name": "Brandon Morrison",
"homepage": "https://www.drupal.org/u/brandonian",
"role": "Maintainer"
},
{
"name": "Pablo López",
"homepage": "https://www.drupal.org/u/plopesc",
"role": "Maintainer"
},
{
"name": "Italo Mairo",
"homepage": "https://www.drupal.org/u/itamair",
"role": "Maintainer"
}
],
"support": {
"issues": "https://www.drupal.org/project/issues/geofield",
"irc": "irc://irc.freenode.org/drupal-contribute",
"source": "https://git.drupalcode.org/project/geofield"
},
"license": "GPL-2.0+",
"minimum-stability": "dev",
"require": {
"phayes/geophp": "^1.2"
}
}
so I create a ludwig.json file which is:
{
"require": {
"phayes/geophp": {
"version" : "1.2",
"url": "https://github.com/phayes/geoPHP/archive/1.2.zip"
}
}
}
but after downloading and extracting the zip file in
modules/geofield/lib/phayes-geophp/1.2
folder, the ludwig still says that the library is missing and the geofield module not working.
Am I doing this right? Is there some step I am missing?
Comments
Comment #2
avpadernoComment #3
devad commentedHi @Lleyton and maintainers of Geofield module.
I am Ludwig module co-maintainer.
I would like to support idea that we add Ludwig integration into Geofield module by providing
ludwig.jsonfile inside your module's root folder in all future Geofield module releases.This would make the life of users not friendly with Composer much easier. :)
phayes/geophp library has file which needs to be loaded manually.
Plus ludwig.json file of course.
Maintenance would not be a big issue in this case. Once new Geofield module module release is out and if library dependencies has changed -
ludwig.jsonfile andgeofield.modulefile should be updated to new library requirements by Geofield module module maintainers just like composer.json file is updated.Here is the patch for current dev.
It's pity that Geofield module branch tests are not functional. I have posted another issue about that. :)
Comment #4
itamair commentedSo is it needed an amend/integration to the phayes/geophp library itself, isn't it?
according to this:
BUT phayes/geophp library (still very solid, the most solid geo library for php) looks not maintained/updated since long time (years)
so it is not possibile to think to integrate it with ludwig.json file ...
Comment #5
itamair commentedand what about all the other modules that rely and depend from Geofield module, such as Geofield Map, Leaflet, Geocoder ... would they need to be integrated with additional ludwig.json file too?
But is really there (still) people trying to skip composer workflow and dependency management with Drupal 8 & 9??
Comment #6
devad commentedRe: @Lleyton #2
After patch #3 is applied Geofield library will be marked as "Missing" still - inside Ludwig's Reports > Packages table.
However, the Geofield module will work nicely.
I have updated an issue for Ludwig to try to add better support for libraries with autoload files here:
#2914840-13: Add support for 'classmap' and 'files' autoload types
Comment #7
devad commented@itamair
The new Ludwig module documentation has been added to Drupal.org recently. Please take a look at guide below where you can find answers to the most of the questions you posted in last few comments:
Ludwig integration guide and FAQ for contrib modules developers and maintainers
Comment #8
devad commentedNEW LUDWIG SERVICE
As of ver. 8.x-1.5 Ludwig module has introduced the
'ludwig.require_once'service to be used by contrib modules who need Ludwig integration for their'classmap'and'files'library types.The new service is making the integration of
'classmap'and'files'library types much easier. Only the one-time integration in contrib module's.modulefile is needed now - without the need for regular updates of that file later. Only theludwig.jsonfile should be kept in sync withcomposer.jsonfile... which means less job for such contrib module maintainers.NEW LUDWIG ARGUMENT - The UX improvement
As of ver. 8.x-1.4 Ludwig module has introduced the new
"disable_warnings"ludwig.jsonargument. It is not mandatory but it can be used and set toTRUEby contrib modules with'classmap'and'files'library types. When set toTRUEit will suppress the warnings for such libraries at Ludwig Reports > packages page (/admin/reports/packages). This is improving the UX of Ludwig module for contrib modules with such libraries.A new patch is attached.
Note: The screenshot is from Geocoder module being used together with Geofield module. See the "Related issue" linked here.
Comment #9
devad commentedPatch reroll for new Ludwig 8.x-1.6 (due to slight service API change).
#2914840-20: Add support for 'classmap' and 'files' autoload types
One line interdiff:
Comment #10
marcom2021 commentedI'm getting an error after saving a node with a geofield field.
Warning: call_user_func_array() expects parameter 1 to be a valid callback, class '\geoPHP' not found in Drupal\geofield\GeoPHP\GeoPHPWrapper->load() (line 21 [...]/modules/geofield/src/GeoPHP/GeoPHPWrapper.php)I'm using Ludwig 8.x-1.6 with patch #9 and Geofield 8.x-1.18. phayes/geophp 1.2 is marked as installed.
Comment #11
devad commentedHi @marcoh182
I can not reproduce the error.
My article with Geofield field is saved without any errors in clean D9 installation..
It might be some collide with other modules.
Also... are you using D8 or D9? And what PHP ver. do you have in your server?
Can you try to reproduce your error on clean D8/D9 installation and report back please.
Comment #12
devad commentedComment #13
itamair commentedThanks @devad. I am not going too much through the way Drupal Ludwig works (as I confidently work with Composer) but would love to integrate Ludwig support into Geofield.
Just let me know when this issue last patch is REALLY RTBC and could be committed into the module ...
I won't really test and review it.
Comment #14
marcom2021 commentedHi devad,
I found the issue. The patch on my geofield.module file somehow got messed up, so the phayes/geophp library was never loaded.
It never crossed my mind to check that file and I was going through all my installed modules and settings for anything that could be conflicting with the geofield module.
Oh well, that's 4 hours of my life I'm never getting back lol.
Comment #15
itamair commentedSo what? Is it working fine for you too @marcoh182 or not???
Comment #16
marcom2021 commentedYes :)
Comment #17
devad commentedHi @itamair. Thanks for getting involved here again.
I have tried my best regarding testing, and I do believe patch #9 is solid one.
I suppose we can move it to RTBC as per #16. Thanks for reporting back @marcoh182.
It would be nice to add Ludwig integration to Geofield module officially.
For maintainers, it is much easier to maintain one ludwig.json file then to deal inside issue queue with all kinds of "how can I use this module without composer" questions.
I have moved to Composer quite some tome ago, but Ludwig was an important bridge-like module for me in the beginning of Drupal 8 adoption.
It has a surprisingly steady usage rate increase at project usage statistics, so, it is continuing to be an important bridge for others obviously.
Comment #18
itamair commentedComment #21
itamair commentedFinally ... all this committed into dev and into a brand new 8.x-1.20 Geofield release, with Ludwig clearly mentioned in Readme.md documentation and drupal.org project front page.
Thanks @devad ... thanks all the other contributors and testers.
Closing this.