Repository navigation
Kirby 6 support - #277
Kirby 6 support#277afbora wants to merge 7 commits into
Conversation
|
I'd be fine with releasing a new major version of this extension and dropping support for Kirby <6 (along with older PHP versions). Then we don't need different code branches for different Kirby versions. What do you think? |
|
@mzur Sounds good. Kirby 6 has many breaking changes, so supporting all versions at once would only add more version checks. Matching the major versions keeps it simple: Uniform v5 for Kirby 3 to 5, v6 for Kirby 6 and v7 for Kirby 7. If that works for you too, I'll:
If you want to keep fixing bugs for Kirby 3 to 5, you could create a |
|
Please go ahead but skip the compatibility table in the readme. Instead, post it here and I will put it into the release notes. |
|
@mzur Ready to review Here is the compatibility table for the release notes:
Uniform v6 requires PHP 8.3 or newer. |
Kirby 6 support
Closes #276
This makes Uniform work with Kirby 6 (tested with 6.0.0-beta.2). As discussed in the comments, it drops support for Kirby 3 to 5, so the code needs no version checks. Uniform v5 stays the version for Kirby 3 to 5.
Changes
Email templates (
uniform-default,uniform-table)Kirby 6 renders templates through
Snippet::load()(getkirby/kirby#7599), which adds$slot,$slotsand the global template data to the template scope. The bundled email templates loop over the whole$dataarray and failed withObject of class Kirby\Template\Slots could not be converted to string. They now loop over$_data, which Uniform already passes to email templates. The email output is the same as before.Missing email preset
Kirby 6 no longer accepts an array as the only argument of its exceptions (getkirby/kirby#8459), so a missing preset threw a
TypeErrorinstead of theNotFoundException. The exception is now created with named arguments.SessionStoreAction
Kirby 6 no longer unserializes objects from the session (getkirby/kirby#8169). The stored
Uniform\Formcame back as__PHP_Incomplete_Classin the next request, so the documentedkirby()->session()->get('user-form')->data('email')failed. The action now stores the form data as an array ($form->data(), HTML-escaped as before):Kirby 6 only
composer.jsonrequires PHP 8.3 or newer, setsextra.kirby.compatibleto^6.0and usesgetkirby/cms: ^6.0@betafor the tests.Str::templatefallback for Kirby 3.5 is removed.Docs
$_datain custom email templates and the reservedslot/slotsfield names.slotorslotscan't be used with email templates.Testing
I ran the steps of the CI workflow locally (
composer validate --strict, freshcomposer install,composer require -w getkirby/cms:^6.0@beta, PHPUnit) with Kirby 6.0.0-beta.2 on PHP 8.3, 8.4 and 8.5. All 85 tests pass. Before this PR, 3 of them failed on Kirby 6.I also tested a page with several forms on Kirby 6.0.0-beta.2: rendering, validation errors, old input, CSRF and honeypot guards, calc guard, the email action (default body, subject template, receive copy, both bundled templates, missing preset), the log action (plain and
uniform/log-json), the webhook action against a local route, the upload action (random prefix, MIME and required rules) and the session store action in the next request. Emails were captured locally and not sent. The login action is covered by the unit tests only.Notes
Please give it a final review and test it with your own setup before merging. Happy to adjust anything.