I need to add a non-exposed field to a node programatically. By non-exposed, I mean a field which users will not be able to interact with. I need to be able to store data in this field through hook_folder_form().

There's always the accepted answer to Add field in hook_node_info();, but that seems to imply that we're talking about exposed fields.

  • You can add a cck field like other fields and restrict the visibility of field by using content access permission. – ARUN Nov 15 '13 at 12:36

You can add field via structure->content types-> manage fields in your content type, add field that you want to hide.

to hide field in a edit-form/node you can use

function yourmodulename_form_alter(&$form, &$form_state, $form_id) {
if (!empty($form['type']['#value']) && $form['type']['#value'] == 'formtypename') {

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.