function domain_entity_field_formatter_view in Domain Access Entity 7
Implements hook_field_formatter_view().
File
- ./
domain_entity.module, line 457 - Defines field (e.g. domain_entity) for entities, and access query alter.
Code
function domain_entity_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
$element = array();
$settings = $display['settings'];
switch ($display['type']) {
case 'domain_entity_sitename':
foreach ($items as $delta => $item) {
$domain = domain_load($item['domain_id']);
if ($domain) {
$element[$delta] = array(
'#markup' => $domain['sitename'],
);
}
else {
$element[$delta] = array(
'#markup' => t('Invalid domain'),
);
}
}
break;
}
return $element;
}