function relation_endpoint_field_formatter_settings_form in Relation 7
Implements hook_field_formatter_settings_form().
File
- ./
relation_endpoint.module, line 213 - Relation endpoints field.
Code
function relation_endpoint_field_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state) {
$view_modes_settings = $instance['display'][$view_mode]['settings']['view_modes'];
foreach (_relation_endpoint_get_endpoint_entity_types($instance) as $endpoint_entity_type => $v) {
$entity_info = entity_get_info($endpoint_entity_type);
$options = array();
foreach ($entity_info['view modes'] as $entity_view_mode => $data) {
$options[$entity_view_mode] = $data['label'];
}
$element['#tree'] = TRUE;
$element['view_modes'][$endpoint_entity_type] = array(
'#title' => t('@endpoint_entity_type view mode', array(
'@endpoint_entity_type' => $endpoint_entity_type,
)),
'#type' => 'select',
'#default_value' => $view_modes_settings[$endpoint_entity_type],
'#options' => $options,
);
}
return $element;
}