How to remove fields that doesn't exist after removing them from API?

Hello, gents,

First of all, I would like to compliment you all for creating a beautiful headless CMS!

Now, followed by my question. I have created a Singleton and a Collection this works fantastic creating fields, nesting, naming everything works just fine.

But removing one field from the collection or Singleton will not remove the field directly from the API.

How can I deal with this and make them disappear after removal? This is pretty annoying right now and doesn’t know what to do.

Thanks in advance!

Warm regards,
Nino

This is a bug and a feature as well, so it never got fixed. If contents would be removed automatically, Cockpit must know, if it really should delete them or if the fields are just hidden from the admin ui.

Have a look here for a solution with a cli command:

And some thoughts, why automatic removing is complicated:

in the current development version is a new cli command to remove a field from collection entries:

./cp collection/removefield --collection {name} --field {name}
3 Likes

Great one. Tried doing this inside my VSCode terminal but i get cp command not found. Am i missing something? thanks.

I didn’t try VSCode, yet, but maybe php ./cp ... works if your console has no clue, what #!/usr/bin/env php means…

1 Like

Thank you!

Seems that VSCode doesn’t support PHP commands out of the box.

This will do!

Hi

./cp collection/removefield --collection {name} --field {name}
For collection but i tested with singleton and print error

$ php ./cp singleton/removefield footer test
Error: command “singleton/removefield” not found!

Please support