Commit ecbf21f7 authored by nicola85's avatar nicola85

Filter types by event type

parent 2115de68
......@@ -373,8 +373,15 @@ function bat_api_services_units_index_calendar($unit_types, $unit_ids, $event_ty
if ($unit_types == 'all') {
$types = array();
foreach (bat_unit_get_types() as $type => $info) {
$types[] = $type;
foreach (bat_unit_get_types() as $type) {
$type_bundle = bat_type_bundle_load($type->type);
if (is_array($type_bundle->default_event_value_field_ids)) {
if (isset($type_bundle->default_event_value_field_ids[$event_type]) && !empty($type_bundle->default_event_value_field_ids[$event_type])) {
$types[] = $type->type_id;
}
}
}
}
else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment