Sorry, we don't support your browser.  Install a modern browser
This post is closed.

Allow extending panel sections too, not only fields

Hello,
I’d like to extend panel sections in the same way fields can be extended.
Use case: so I can replicate their behaviour, only changing the template.

Documentation for extending fields : https://getkirby.com/docs/reference/plugins/extensions/fields#extending-existing-fields

5 years ago

For people looking to extend core sections (by force), I did some tests to replicate kirby’s field-section behaviour in a custom section or field component with the hope of changing them to my needs (fix translations in some fields and add tabs to sections in the panel) :
Of course, my intention was to preserve full functionality of all sub-fields.

  • A field of type group (almost undocumented) is not a field but a hardcoded behaviour in kirby’s core code (blueprint parsing and some other places). Replicating its behaviour is not easy without hacks.
  • The same goes for the fields section : try to make a section that behaves exactly as kirby’s fields-section by duplicating the code: it won’t work as some logic is hardcoded outside of the section code:
    if($section['type']=='fields'){normalizeFields($section['fields']);} // <-- Meh, my section type is "awesomefields"
    Interestingly, it’s possible to replicate the vue part of core components, but for everything to work as expected, there needs to be a (hidden) duplicate entry of every field of the custom section blueprint (so the php part works as expected).

After a quick glimse at the core code, I think it can be quite hard to implement such a thing because the logic is different (not so OOP) and the core sections obviously aren’t meant to be to be extended as the fields can be.

5 years ago
Changed the status to
Completed
11 days ago

In Kirby 6.0.0 sections became fields. The pages and files sections are now the pagelist and filelist fields. They are regular field classes, so you can extend them like any other field.

11 days ago
1