Field API - defining a field, attaching it to privatemsg, and populating it "behind the scenes" This is actually related to a previous question ( Appending markup to privatemsg message body ) but as it's a slightly different issue I figured I'd start a new question.

In my original question, tenken's suggestion is to create a new module implementing hook_field_info(), then use field_create_field() and field_create_instance() on hook_enable() to attach the custom field to the privatemsg bundle.

I have sort of figured out the gist of defining a custom field and attaching it to a bundle, but I'm stuck with a few things despite extensive googling, searching drupal.org and documentation as well as searching for video tutorials on YouTube. Specifically:


when populating arrays to use with field_create_field() and field_create_instance(), I'm not sure what I should specify for the entity_type value. I know typical examples for these functions usually refer to 'user' and 'node', but what should it be for privatemsg?
I don't want the field to be visible on any forms as it's only intended to be populated "behind the scenes". I understand that I need to define a custom field formatter for that. How do I do that?


I think those are my only obstacles at the moment. Sorry if I appear lazy at all, but I only have very limited experience with Drupal module development, much less the field API, and this is my first D7 module. Needless to say I have searched for specific answers to the above but they continue to elude me!

Thanks
There is no need to define your own field type, just use a simple text field. You are storing a string after all, no need to re-invent the wheel.

The entity_type of privatemsg is privatemg_message. Note that you are not required to specify this property as the purpose of it is to limit the field for certain entity types. Leaving it empty means that instances of it can be attached to any entity.

To hide the field, you could use a module like Field permissions which gives you fine-tuned permission-based control over all fields. What that module actually does is provide a user interface for hook_field_access(), so you can alternatively implement that hook yourself and simply return FALSE for the field you created based on the field name.