Here's a useful one you may not know about: field_get_items(). Basically, if you're trying to get field values off an entity, it can be fiddly - dealing with language, indices, etc. This function makes it much simpler. Just give it the Entity Type (e.g. 'node'), the entity itself and the field name (e.g. 'body'), and it will return the value that you are looking for.
Although I'd probably create fields through the UI and export using the Features module (because I'm lazy), if you feel like adding fields to an entity programmatically, you might find http://drupal.org/node/1228878 helpful. That page actually covers:
With Drupal 7's support for Field API, even the die-hard opponents of old-style CCK will find themselves using fields, and (hopefully) entities. But...how do you run a query efficiently on a field which could have multiple values?
The answer lies in EntityFieldQuery. Here are some examples of how it can be used:
Recent comments