Here is small snippet of php code that will help you get a list of all Content types in an instance along with the fields within the content type. It came handy to me when I wanted to give a list of conent types with fields to one of my clients for remapping them to the new structure that they wanted to build.
$content_types = node_get_types(); $output = ''; foreach($content_types as $content_type => $content_type_object) { $output .= "" . $content_type_object->name . ""; $output .= ' '; $fields = _content_type_info(); $fields = $fields['content types'][$content_type]['fields']; $ouput = ''; foreach ($fields as $field_name=>$field) { $output .= $field['widget']['label']; $output .= ' '; } }
Thank you.
ReplyDeletewhy?
ReplyDeleteFatal error: Call to undefined function _content_type_info()
seems the function does not exist?
sorry, you need cck module active, of course.
ReplyDelete