Location -> samples, fixed cs display, fixed empty field

This commit is contained in:
Bachir Soussi Chiadmi
2016-12-11 10:17:00 +01:00
parent 5f6a9ac5d1
commit 41e3e6dfb2
8 changed files with 130 additions and 86 deletions

View File

@@ -63,7 +63,7 @@ function materio_showroom_field_info() {
function materio_showroom_field_is_empty($item, $field) {
// dsm($item,'item');
// dsm($field,'field');
return empty($item['location']) && empty($item['showroom_tid']);
return empty($item['location']); // && empty($item['showroom_tid'])
}
// ______ __
@@ -115,12 +115,14 @@ function materio_showroom_field_formatter_view($entity_type, $entity, $field, $i
// This formatter simply outputs the field as text.
case 'materio_showroom_location_simple_text':
foreach ($items as $delta => $item) {
$term = taxonomy_term_load($item['showroom_tid']);
$element[$delta] = array(
'#type' => 'html_tag',
'#tag' => 'p',
'#value' => t('%showroom : @loc', array('%showroom' => $term->name, '@loc' => $item['location'])),
);
if(!empty($item['location'])){
$term = taxonomy_term_load($item['showroom_tid']);
$element[$delta] = array(
'#type' => 'html_tag',
'#tag' => 'p',
'#value' => t('%showroom : @loc', array('%showroom' => $term->name, '@loc' => $item['location'])),
);
}
}
break;
}