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

@@ -1303,7 +1303,6 @@ function materio_administration_menu_default_menu_links() {
t('Publication');
t('Reports');
t('Shopping cart');
t('Showroom');
t('Showrooms');
t('Simplenews newsletter');
t('Store');

View File

@@ -933,10 +933,11 @@ function materio_administration_views_default_views() {
$handler->display->display_options['fields']['field_localisation']['id'] = 'field_localisation';
$handler->display->display_options['fields']['field_localisation']['table'] = 'field_data_field_localisation';
$handler->display->display_options['fields']['field_localisation']['field'] = 'field_localisation';
/* Field: Content: Location */
/* Field: Content: Samples */
$handler->display->display_options['fields']['field_location']['id'] = 'field_location';
$handler->display->display_options['fields']['field_location']['table'] = 'field_data_field_location';
$handler->display->display_options['fields']['field_location']['field'] = 'field_location';
$handler->display->display_options['fields']['field_location']['label'] = 'Location';
$handler->display->display_options['fields']['field_location']['click_sort_column'] = 'showroom_tid';
$handler->display->display_options['fields']['field_location']['delta_offset'] = '0';
$handler->display->display_options['fields']['field_location']['multi_type'] = 'ul';

View File

@@ -158,7 +158,7 @@ function showroom_field_default_field_instances() {
),
'entity_type' => 'node',
'field_name' => 'field_location',
'label' => 'Location',
'label' => 'Samples',
'required' => 0,
'settings' => array(
'entity_translation_sync' => FALSE,
@@ -1265,10 +1265,10 @@ function showroom_field_default_field_instances() {
t('Body');
t('Description');
t('Email');
t('Location');
t('Mémo');
t('Nom');
t('Phone');
t('Samples');
t('Showroom');
return $field_instances;

View File

@@ -20,7 +20,7 @@ function showroom_field_group_info() {
$field_group->mode = 'form';
$field_group->parent_name = 'group_htabs';
$field_group->data = array(
'label' => 'Showroom',
'label' => 'Showroom Samples',
'weight' => '17',
'children' => array(
0 => 'field_localisation',
@@ -28,19 +28,20 @@ function showroom_field_group_info() {
),
'format_type' => 'htab',
'format_settings' => array(
'formatter' => 'closed',
'label' => 'Showroom Samples',
'instance_settings' => array(
'description' => '',
'classes' => 'group-showroom field-group-htab',
'required_fields' => 1,
'classes' => 'group-showroom field-group-htab',
'description' => '',
),
'formatter' => 'closed',
),
);
$field_groups['group_showroom|node|materiau|form'] = $field_group;
// Translatables
// Included for use with string extractors like potx.
t('Showroom');
t('Showroom Samples');
return $field_groups;
}

View File

@@ -16,6 +16,7 @@ dependencies[] = materio_content_types
dependencies[] = materio_page_title
dependencies[] = materio_showroom
dependencies[] = materio_subscriptions
dependencies[] = materio_user_profiles
dependencies[] = menu
dependencies[] = metatag
dependencies[] = node

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;
}