How does one add a Location CCK field and instance programmatically to a content type in a Drupal 7 module install? I am mainly concerned with what params need to be given to the field_create_field
and field_create_instance
functions, assuming it is created in the same way as core fields? I've put some examples of the params I give to these functions in creating core fields (in case this helps):
An example of the params given to field_create_field
:
'field_property_price' => [
'field_name' => 'field_property_price',
'label' => $t('Price'),
'cardinality' => 1,
'type' => 'text',
'module' => 'text',
'length' => '20'
];
An example of the params given to field_create_instance
:
'field_property_price' => [
'field_name' => 'field_property_price',
'label' => $t('Price'),
'cardinality' => 1,
'required' => true,
'widget' => [
'weight' => '0',
'type' => 'text_textfield',
'module' => 'text',
'active' => 1,
'settings' => [
'size' => '20',
],
],
],
Thanks for reading.