I have a form, and want to generate a list of the form's field-names. Here is how I currently do it:
$fieldnames = array();
foreach ($form as $key=>$val){
if (substr($key, 0, 6) === 'field_'){
$fieldnames[] = $key;
}
}
Is there a better way to do this?
UPDATE: Just to clarify ... I am wondering whether there is a less "kludgey" way of doing this. For example, does the content module provide an api function that loops through fields. (I couldn't find one.)