In my custom form I have a file upload, which follows the array structure of `file_element_info()` in file.module in core. This is consistent with examples in examples module and date module has `_date_api_element_info()`.

But looking at geofield or at openlayers and other modules I can not see what array values are possible/required. 

As a general rule how do I find out how to add a field of a specific type to a custom form?


----------


**Edit #1:**
Just read [Where can I find complete documentation of hook_field_info?][1] and everyone is being really helpful about Field API, but it is a steep learning curve. A specific example would really help (an not one of the simple core field types).


----------


**Edit #2:**
So on my particular example in `geofield.module` I got (got the same using `dpm(field_info_field_types('geofield'));`):

    function geofield_field_info() {
      return array(
        'geofield' => array(
          'label' => 'Geofield',
          'description' => t('This field stores geo information.'),
          'default_widget' => 'geofield_wkt',
          'default_formatter' => 'geofield_wkt',
          'instance_settings' => array(
            'local_solr' => array(
              'enabled' => FALSE,
              'lat_field' => 'lat',
              'lng_field' => 'lng',
            ),
          ),
          'property_type' => 'geofield',
          'property_callbacks' => array('geofield_property_info_callback'),
        ),
      );
    }

But how does that translate to a form field array?

    $form['location'] = array(
        '#title' => t('Location'),
        '#type' => 'geofield',
    	'#required' => TRUE,
    );

Or do I have the wrong end of the stick here?

  [1]: https://drupal.stackexchange.com/questions/54647/where-can-i-find-complete-documentation-of-hook-field-info/54671