Drupal - Hide field when creating a node
If I understand your question, I think that you can use a custom module (in this example, the name of the module is test_remove_field
) and include the following code:
function test_remove_field_form_alter(&$form, &$form_state) {
if (arg(0) == 'node' && arg(1) == 'add') {
$form['field_test']['#access'] = 0;
}
}
Note: remember that field_test
must be your respective field name.
The Field Permissions module allows you to set field level permissions:
- Create field (edit on content creation)
- Edit field regardless of content author
- Edit own field on content created by the user
- View field regardless of content author
- View own field on content created by the user
You can use these options to enable role based permission for a field.
When permissions are enabled, access to this field is denied by default and explicit permissions should be granted to the proper user roles from the permissions administration page. On the other hand, when these options are disabled, field permissions are inherited from the content view and/or edit permissions. In example, users allowed to view a particular node will also be able to view this field, and so on.
Field permissions
I'd use hook_form_alter() and set the ['#access']
property to FALSE
just like the answer by @moon.watcher.
If you're in Drupal 6, you'd need a module for doing this. In Drupal 7 you can call hook_form_alter() from your template.