function opigno_field_formatter_view in Opigno 7
Implements hook_field_formatter_view().
File
- ./
opigno.module, line 292 - Contains all hook_implementations and module specific API.
Code
function opigno_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
global $user;
$element = array();
switch ($display['type']) {
case 'opigno_tools_name':
foreach ($items as $delta => $item) {
$info = opigno_get_tool($item['tool'], $entity, $user);
if (!empty($info)) {
$element[$delta] = array(
'#type' => 'html_tag',
'#tag' => 'p',
'#value' => check_plain($info['name']),
);
}
}
break;
case 'opigno_tools_tool':
foreach ($items as $delta => $item) {
$info = opigno_get_tool($item['tool'], $entity, $user);
if (!empty($info)) {
$element[$delta] = array(
'#theme' => 'opigno_tool',
'#tool' => $info,
'#course' => $entity,
);
}
}
break;
}
return $element;
}