Development | Updates - 15/02/21 #541
johanjanssens
announced in
Announcements
Replies: 1 comment
-
Awesome updates Johan, looking forward to testing these! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
It's been a productive weekend working on the Joomla extension for Pages. The Joomla extension integrates specific Joomla API's and functionality more closely into Pages.
Here is a little update
1. Custom field support
With the feedback from @woluweb worked on improving the custom fields support. Added support for, rendering custom fields to html, made it easier to get access to the custom field value and other properties, and made it possible to filter a collection on custom fields.
Custom fields can be filtered through:
field[foo]=bar
syntaxcollection()
template functionMore info I added to the PR: #363. Custom fields are now fully integrated.
2. Event handling
Added support for handling Joomla events. Events are a very powerful feature and allow developers to extend and customise how Joomla works. They implement an inversion of control pattern, commonly known as 'Don't call us, we will call you'.
One of the things I always wanted to improve was to make it easier to handle events. Right now you need to create a Joomla plugin, install it, enable it, etc, etc. Quite cumbersome.
If the Joomla extension is installed in your Pages site you will be able to intercept any Joomla event, either core or third party and you can handle them very easily by adding a listener or a handler. A handler is a class that can handle multiple events at the same time ((similar to a plugin), a listener is a single function.
Listeners are as simple as it gets. You just add a file where the name of the file is the name of the event and in the file, you return a closure to handle the event. Example:
You can add the handlers and the listeners to the Pages extension (learn more about that here), to extend custom functionality for the specific site, or you can add them to your own Pages extensions.
Note that events are always captured regardless if Pages is actively rendering the current page. So even if you are not using Pages for rendering, you can use it to handle events!
Happy coding!
Beta Was this translation helpful? Give feedback.
All reactions