By mrodgers on
I created a custom node after reading the documentation and I have several fields being displayed that I did not put in the hook form. I am using 5.0.
Those fields include: Log message, URL Path Settings, Comment Settings, Authoring Information, Publishing Options and Preview.
How can I hide these fields and field groups from displaying in the input form for my custom node? Also I may want to do this in a multi-step form is this possible?
Thanks in advance
Comments
Node settings
I assume you have to set the field to null. If you want to know what fields are part of the $node object, with PhP 4 you can print_r($node) inside a function that normally returns output, and it will show you all of the fields in the $node object at the top of the page. I'm not sure if this works with PHP5 (because object declaration/proper array type-casting was one of the major improvements of PHP5.
So for this example, if hoser_id (for all of you Canucks out there, yah! go Canada) is part of the $node object, then $node->hoser_id = null should destroy that field. Hopefully nothing else will repopulate that field in the next function call.
Dave
hook_form_alter
Only users with "Administer Nodes" rights will be able to see those fields (or at least, most of those fields), so log in as a "regular" user and see what's still there on the form. If there's still stuff there that you don't want, you are probably looking for hook_form_alter.
-------
http://www.funnymonkey.com
Tools for Teachers
Thanks
Thanks you both for your comments - very helpful