Hi,
Continuing on this forum topic: http://drupal.org/node/1143260 .
I've created another test module where I have some more success this time.
Now I'm getting my "option" (or whatever this would be called) in the dropdown when managing fields of a content type. I can add and save my custom field but when I go to the manage display I get this error:
Warning: Invalid argument supplied for foreach() in field_ui_formatter_options() (line 1451 of /Users/avrilverhaeghen/Sites/drupal-7/modules/field_ui/field_ui.admin.inc).
This is my entire module file:
function soundcloudtest_field_info(){
return array(
'soundcloudtest_player' => array(
'label' => t('Soundcloud test player'),
'description' => t('Embeds the player of Soundcloud by using the URL'),
'default_widget' => 'soundcloudtest_widget',
'default_formatter' => 'soundcloudtest_formatter',
),
);
}
function soundcloudtest_field_formatter_info(){
return array(
'soundcloudtest_formatter' => array(
'label' => t('Simple url formatter'),
'field types' => 'soundcloudtest_player'
),
);
}
function soundcloudtest_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display){
$element = array();
foreach($items as $delta => $item){
$el = $item;
}
$options = array(
'html' => TRUE,
);
$pl = l($el,$options);