Id of structured field

Hey there,

currently i am building a foodmenu page with order funktion. Products can be added via panel in a structured field. Now the point is that later i need to fetch an id or smth like that of the structured field entity (product) to validate the price etc. in a controller.

How would you deal with that?

Structure fields don’t have IDs (yet). So the easiest way to achieve this would be the use of pages, because they have UUIDs out of the box. Also, easier to handle when it comes to translations (if that’s relevant for you).

You can also add IDs to structure fields using hooks (don’t know if the AutoID plugin which supported unique IDs for structure fields is still working, as it has been archived).

Good morning,

thanks for your reply, i suspected that. Is there any out of the box way to hide the url field in the page-creation process? Because i won’t use the page as a page this field would be confusing.

I’m afraid I don’t understand what you mean by url field in this context…

Do you mean prevent those pages from being accessible via URL? You can use a route to be on the safe side (although if you don’t render the URL anywhere, it will not be indexed by search engines).

It’s possible in Kirby 4 afaik.

Thanks again for your quick reply. Having the URL available is completely okay for me, cause i never use it in the frontend as you mentioned. If it is called it will refere to the 404-Page.

I just mean the url-field in the creationcontext-window. I have attached an example:

This field creates the slug of the page, in K4 you can adapt the dialog and it should be possible to hide the field (not sure if this is already implemented)

I think its not implemented yet. Didnt find it here: Page creation dialogs | Kirby CMS
and testet it with

  slug: false
    - price

But i think i will take care of it in the future. Thank you very much for your help and the information.