I tried copying the functions from the field module in [example modules][1] to get a field to show up in Manage Fields without necessarily any functionality
Looking at the answer to this question, only field_create_field() and hook_field_info() should do the trick but I never got that working with the following code:
function entityreference_add_new_field_info() {
return array(
'entityreference_add_link' => array(
'label' => t('Entityreference link'),
'description' => t('Entityreference link'),
'default_widget' => 'entityreference_link_widget',
'default_formatter' => 'entityreference_link_formatter',
),
);
field_create_field('entityreference_add_link');
}
Putting `field_create_field()` outside of `hook_field_info()` returns 'call to undefined function' error.
**Update:** Here's one thing I've tried without success:
function entityreference_add_new_field_info() {
return array(
'entityreference_add_link' => array(
'label' => t('Entityreference link'),
'description' => t('Entityreference link'),
'default_widget' => 'entityreference_link_widget',
'default_formatter' => 'entityreference_link_formatter',
),
);
field_create_field('entityreference_add_link');
$instance = array(
'field_name' => 'entityrefernce_add_link',
'entity_type' => 'node',
'label' => 'The Link',
'bundle' => 'node',
);
field_create_instance($instance);
}
enter code here
[1]: http://drupal.org/project/examples