If i change the image order in the panel it doesn’t affect the order in my front-end?
Also when I replace an image from a subpage the parent page still shows a preview of the old image. How do I handle this kind of behaviour? I want my user to be able to switch images around in the panel and display them in that order on the front-end and I need the first image to be the main image on the page.
It comes from my content folder (which doesn’t properly update) when I change things in the panel. When I delete the image in the panel it is still in my content folder. And it is the first image link in there.
Since it’s a files field you want to do something different then.
You want to convert the list of files stored in your gallerijfield into a files collection first.
$behandeling->gallerij()->toFiles()
Using ->images() returns all the images attached to that specific page.
That’s also why removing the image from the field doesn’t remove it from the folder.
You’re not actually deleting the image, you’re simply removing it from the list stored inside your txt file
Files fields and Files sections work in a different way even though they look similar.
A files field allows you to store a reference list of files along with the rest of your content inside the txt file.
A files section on the other hand, doesn’t store anything inside the main txt file but allows you to access the files stored inside the content folder directly.
They can be confusing at first but you get used to both pretty quickly.
I have no idea what your use case is so it’s hard to tell
It usually depends by the type of page you have and how you want to handle things on the frontend.