Creating Select Fields in a module with Drupal 7 I am trying to write my own module to add a content type with the help of node_example and this page. I made small tweaks and got it to work, yet I cannot find any example to create a select box as a field, and I failed in my each attempt. I have also checked the official documentation for field_create_field, still no clues. 

Is there any documentation or sample you can guide me?
Something like this should work:

// Create field definition
$field = field_info_field('field_my_select_field');
if (empty($field)) {
  $field = array(
    'active' =&gt; '1',
    'cardinality' =&gt; '1',
    'deleted' =&gt; '0',
    'entity_types' =&gt; array(),
    'field_name' =&gt; 'field_my_select_field',
    'foreign keys' =&gt; array(),
    'indexes' =&gt; array(
      'value' =&gt; array(
        0 =&gt; 'value',
      ),
    ),
    'module' =&gt; 'list',
    'settings' =&gt; array(
      'allowed_values' =&gt; array(
        'Yes' =&gt; 'Yes',
        'No' =&gt; 'No',
      ),
      'allowed_values_function' =&gt; '',
    ),
    'translatable' =&gt; '0',
    'type' =&gt; 'list_text',
  );

  $field = field_create_field($field);
  drupal_set_message('Created field_my_select_field');
}

// Create field instance on entity bundle
if(!field_info_instance('node', 'field_my_select_field', 'my_node_type')){
  $instance = array(
    'bundle' =&gt; 'terms',
    'default_value' =&gt; array(
      0 =&gt; array(
        'value' =&gt; 'Yes',
      ),
    ),
    'deleted' =&gt; '0',
    'description' =&gt; '',
    'display' =&gt; array(
      'default' =&gt; array(
        'label' =&gt; 'hidden',
        'module' =&gt; 'list',
        'settings' =&gt; array(),
        'type' =&gt; 'hidden',
        'weight' =&gt; '4',
      ),
    ),
    'entity_type' =&gt; 'node',
    'field_name' =&gt; 'field_my_select_field',
    'label' =&gt; 'My field label',
    'required' =&gt; 0,
    'settings' =&gt; array(),
    'widget' =&gt; array(
      'active' =&gt; 1,
      'module' =&gt; 'options',
      'settings' =&gt; array(),
      'type' =&gt; 'options_select',
      'weight' =&gt; '3',
    ),
  );
  field_create_instance($instance);
  drupal_set_message("Added field_my_select_field field to node");
}