<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:arial, helvetica, sans-serif;font-size:12pt"><DIV></DIV>
<DIV>From the RealName module:</DIV>
<DIV><FONT size=2 face="Courier New, courier, monaco, monospace, sans-serif"> $all_fields = content_fields(NULL, $type);<BR> if ($all_fields) {<BR> foreach ($all_fields as $field_name => $field_attributes) {<BR> // If it's not the type we are looking for, then skip the field.<BR> if ($field_attributes['type_name'] != $type) {<BR> continue;<BR> }<BR> switch ($field_attributes['type']) {<BR> case 'text':<BR> if ($field_attributes['multiple']) {<BR> drupal_set_message(t('The RealName module does not currently support fields with multiple values, such as @fld.', array(</FONT><A href="mailto:'@fld'"><FONT
size=2 face="Courier New, courier, monaco, monospace, sans-serif">'@fld'</FONT></A><FONT size=2 face="Courier New, courier, monaco, monospace, sans-serif"> => $field_name)), 'warning');<BR> }<BR> else {<BR> $selected = array_key_exists($field_name, $current);<BR> $fields[$field_name] = array(<BR> 'title' => $field_attributes['widget']['label'],<BR> 'weight' => $selected ? $current[$field_name] : 0,<BR> 'selected' =>
$selected,<BR> );<BR> }<BR> break;</FONT></DIV>
<DIV><FONT size=2 face="Courier New, courier, monaco, monospace, sans-serif"> case 'link':<BR> $links[$field_name] = $field_attributes['widget']['label'];<BR> }<BR> }<BR> }<BR> else {<BR> drupal_set_message(t('The !type content type has no fields to use.', array('!type' => $type)), 'error');<BR> }<BR></FONT><BR> </DIV>
<P><FONT color=#ff007f size=4 face="bookman old style, new york, times, serif"><EM><STRONG>Nancy</STRONG></EM></FONT></P>
<P> </P>
<P><FONT face="arial, helvetica, sans-serif">Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.</FONT></P>
<DIV><BR></DIV>
<DIV style="FONT-FAMILY: arial, helvetica, sans-serif; FONT-SIZE: 12pt"><BR>
<DIV style="FONT-FAMILY: Courier New, monaco, monospace, sans-serif; FONT-SIZE: 10pt"><FONT size=2 face=Tahoma>
<HR SIZE=1>
<B><SPAN style="FONT-WEIGHT: bold">From:</SPAN></B> Fernando Correa da Conceição <fernando@jaguaribe.net><BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> development@drupal.org<BR><B><SPAN style="FONT-WEIGHT: bold">Sent:</SPAN></B> Wed, January 19, 2011 9:59:17 AM<BR><B><SPAN style="FONT-WEIGHT: bold">Subject:</SPAN></B> [development] How to list fields and types<BR></FONT><BR>I have a $node object, in this node there is some fields (Drupal 7). The module works on all contents type, so i do not know what fields the node have. I need to list all fields from a node and get the type of field.<BR>Someone can show a example how to do this please?<BR><BR>Thanks.<BR></DIV></DIV></div></body></html>