I am struggling to get a working custom implementation of a cck_phone field from the cck_phone module. I have included my partially working code at the bottom.
What seems to be not working is that the function
cck_phone_phone_number_process expects to be able to retrieve information about the widget with
$instance = field_widget_instance($element, $form_state);
$settings = $instance['settings'];
However in my implementation,
field_widget_instance($element, $form_state) returns NULL, resulting in both
$settings being NULL and problems further on in the
What does work is that the code below does render a properly populated country code dropdown and phone number entry textfield.
My code to create the custom cck_phone field:
$form_section['phone']['field_phone_home'] = array( '#type' => 'phone_number', '#field_parents' => array( 'profile_personal_information' ), '#field_name' => 'field_phone_home', '#language' => 'und', '#delta' => 0, );