Forum
How to hide an "image" type field in the control panel?
I'm using the Blog app and have a custom author field which is an image (and is part of the author.html template). When I output that image as part of Blog's post.html template the author image field is undesirably added to the post edit screen in Perch. In other cases I can set the "type" of the custom author field to "hidden" to hide it from the control panel, but in this case it needs to be "image" to use Perch's resizing and cropping.
How can I hide it from the control panel and retain the sizing/cropping of the "image" type?
Perhaps there is a way to include a template for output but NOT include the fields in the control panel?
At the top of your template, use the same ID as a
type="hidden"
field.Tried that, and it seems that the second (last) use of that ID is dictating the form display. In the below template the "Oh Boy!" tag appears in the edit form, not the "Hello!" tag: [[[ edit: actually, it doesn't matter if the "Hello!" tag is at the top or bottom of the template, or if the other tag attributes are included. ]]]
Hmm, I guess that will happen with images. We can the template for all options and process them all.
I think the solution is probably to use two templates - one for editing and one for display.
Okay, thanks for your insight. Sounds like a decent plan.
As a kludge I'm using a bit of jquery to remove that field in the edit form, fully aware that a future update could break this code.
Please don't do that. The edit forms are far more complex than they might appear, and if you start messing with the fields we can't guarantee that they'll work in the way you expect.
Noted, thanks!