Joomla 4 Beta was released on 30 May 2020 and I am happy to see that this causes much excitement and many interesting discussions in the Joomla Community.
Amongst the new major feature we have :
The new media manager, which will be obviously useful to all users, The workflow, which will be useful in many cases, And Webservices, which is more a developer thing but really open new possibilities. This will indeed allow for example to use your Joomla website as a source for other websites/apps/…
So in this context of Webservices I was thinking : what about using Joomla Custom Fields to synchronise data from other sources (like open-data in json format for example) ?
- So instead of having Joomla feeding other websites/apps/… like we will be able to do with J!4, we can already easily feed J!3 from external sources.
- Thanks to the Joomla friends on https://forum.joomla.fr we quickly came up with a simple plugin, very light and very easy to edit/customise.
- To have a preview of how to synchronise your Custom Fields with an external source on a multilingual Joomla website, you can already see https://sync.joomlacustomfields.org/fr/
Chat from our meeting:
Custom fields presentations:
Template suggestion - astroid:
New version of tool:
working on by: Alexandre Elise & Crostophe Avonture
Link to the current version of the plugin : https://github.com/woluweb/updatecf/
As already said, a newer vesion is being coded with a CLI script too.
Can you validate the data?
- For the moment the data is from a 'trusted source'.
- For sanitization, actually (version 1) there is none i.e. the plugin get the information from the JSON source (which is a trusty source) and get the value. The email is taken in the JSON and saved in the email CF.
- It will be possible (with extra coding) to define the expected data type (the email should be … an email (not just a text) and we can check this with f.i. regular expression)
- But will requires extra coding.
- We can use joomla api to validate the email: PunycodeHelper::emailToUtf8($email) if think
- we could also use the build it Form::validate() or InputFilter too
Quesiton about additional use... what if you havfe different categories with different fields?
- Technically, it just to solve the question : how can we match the CF with the JSON array.
- If that Matching can be done in a separate JSON, why not…
- Anyway, the actual version is doing an hardcoding match and that's bad.
- From Olivier Buisard to Everyone: 03:05 PM
- you could also use a repeatbale field to create the matching of fields with the json element
- From Alexandre ELISÉ to Everyone: 03:06 PM
- nice one olivier
- but repeatable fields are upper bound to 1000 fields
- csv or real json file import might be simpler what do you think?
- From Olivier Buisard to Everyone: 03:07 PM
- I think we are not talking about the same thing :-) you would not have that many custom fields to match to the json fields
From Dorothy Firsching to Everyone: 03:07 PM
Does this give us a Joomla MARKETING hook to expand its use relative to its competition? Becoming the "glue" across websites?
Do you have plans to make this work available in a format that you can list in the JED - as a Joomla Extension so the Joomla Community while widely know of it?
- Not yet. Currently focusing on making the tool work properly it will be avaialble on github. It needs to be more universal to be added to the JED
- To make that universal you would need to add more options so you can define the fields you want to fetch from the external source.
- not on the jed because it uses php7.2
- jed requires 5.3 minimum
- olivier gave a cool idea for that
Keep it simple and just create a new plugin for every new json source you need. Like that you can turn them on/off separately
Repeatable fields for dynamic field mapping
roland tool is cool too
From Olivier Buisard to Everyone: 03:25 PM
Stewart, I like your background :-)
Marc's presentations are all very interesting and I urge everyone to check them out.