Posted By

JohnnyGamba on 12/13/10


Tagged

drupal


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

qubestream


Get an array with the names fields of a determined type of content


 / Published in: PHP
 

This snippet saves in the $return array all the names of the fields that a content type has added with CCK, has to be installed the cck module.

  1. $type_name = 'contacto'; #Content Type name
  2. $type = content_types($type_name); #Get all the info of the type
  3.  
  4. if ($type) {
  5.  
  6. $return = array();
  7.  
  8. foreach ($type['fields'] as $field_name => $field) {
  9.  
  10. $return[] = $field['field_name'];
  11. }
  12.  
  13. $return = implode("\n", $return);
  14. } else {
  15.  
  16. $return = FALSE;
  17. }

Report this snippet  

You need to login to post a comment.