tags:

views:

156

answers:

1

Any good CCK API docs out there? I have seen http://api.audean.com/, but can't find what I want there.

Basically, I need a function that takes a field name and returns what node type has that field. I wrote my own, but would rather make an API call.

+1  A: 

CCK is an awesome module but has terrible, outdated documentation. :(

Looking through the module files revealed content_fields($field_name) which may provide the functionality you are looking for.

The function takes in the field name and returns an array of all the settings for that field. The node type is stored in ['type_name'] so you could write something like the following:

$field = content_fields('field_myfield');
$node_type = $field['type_name'];

That should give you the node type for field_myfield.

calebthorne
Thanks. I just figured that one out. The docs said it was a private fn, but just realized they must have changed it to public. Any idea if there's an API call somwhere to get "all" fields for a content type, not just CCK fields?
Aaron