barebones for a couple of fields
This commit is contained in:
parent
dbfaa19328
commit
991369e91d
@ -29,3 +29,43 @@ function fulcrm_collection_menu() {
|
|||||||
|
|
||||||
return $items;
|
return $items;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function fulcrm_collection_to_form( $collection_data, $d = array() ) {
|
||||||
|
$form = array();
|
||||||
|
|
||||||
|
foreach ( $collection_data[ '_structure' ] as $set_data ) {
|
||||||
|
switch ( $set_data[ 'type' ] ) {
|
||||||
|
case 'ddataset':
|
||||||
|
$fieldset = array( '#type' => 'fieldset',
|
||||||
|
'#title' => $set_data[ 'name' ],
|
||||||
|
'#description' => $set_data[ 'description' ],
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ( $set_data[ 'fields' ] as $field_data ) {
|
||||||
|
switch ( $field_data[ 'type' ] ) {
|
||||||
|
case 'text':
|
||||||
|
case 'email':
|
||||||
|
case 'tel':
|
||||||
|
$fieldset[ $field_data[ 'key' ] ] = array( '#type' => 'textfield',
|
||||||
|
'#title' => $field_data[ 'name' ],
|
||||||
|
'#description' => $field_data[ 'description' ],
|
||||||
|
'#required' => $field_data[ 'required' ],
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
drupal_set_message( t('Cannot handle ":type" collection structure.', array( ':type' => $field_data[ 'type' ] )), 'error' );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$form[] = $fieldset;
|
||||||
|
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
drupal_set_message( t('Cannot handle ":type" collection structure.', array( 'type' => $set_data[ 'type' ] )), 'error' );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $form;
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user