function wshybridfield_field_formatter_view in Web Service Data 7
Implements hook_field_formatter_view().
File
- modules/
wshybridfield/ wshybridfield.module, line 191
Code
function wshybridfield_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
$element = array();
foreach ($items as $delta => $settings) {
if (isset($settings['wsdata_error'])) {
$element[$delta]['#markup'] = $settings['wsdata_error'];
continue;
}
if (!isset($display['settings']['wsprocessor'])) {
$element[$delta]['#markup'] = t('No wsprocessor configured for this display');
continue;
}
$processor = $display['settings']['wsprocessor'];
if (!class_exists($processor) or !is_subclass_of($processor, 'WsData')) {
$element[$delta]['#markup'] = t('Unable to load wsprocessor @wsprocessor', array(
'@wsprocessor' => $display['settings']['wsprocessor'],
));
continue;
}
$processor = new $processor($settings['wsdata'], $settings);
$form = array();
$element[$delta] = $processor
->getData();
}
return $element;
}