From 89cd821eb3e8d01fac332ba404eb9295d318b21c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Caruso?= Date: Wed, 16 May 2018 12:50:30 +0200 Subject: [PATCH] ROOMS-122: Add relationship handler for units from commerce line items --- .../views/rooms_booking_manager.views.inc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/modules/rooms_booking_manager/views/rooms_booking_manager.views.inc b/modules/rooms_booking_manager/views/rooms_booking_manager.views.inc index 1b8f02c..87d8a79 100644 --- a/modules/rooms_booking_manager/views/rooms_booking_manager.views.inc +++ b/modules/rooms_booking_manager/views/rooms_booking_manager.views.inc @@ -6,6 +6,23 @@ */ +/** + * Implements hook_views_data_alter(). + */ +function rooms_booking_manager_views_data_alter(&$data) { + if (isset($data['field_data_rooms_booked_unit_id']['rooms_booked_unit_id_value'])) { + $data['field_data_rooms_booked_unit_id']['rooms_booked_unit_id_value']['relationship'] = array( + 'title' => t('Booked Unit'), + 'help' => t("Relate this field to its bookable unit"), + 'handler' => 'views_handler_relationship', + 'base' => 'rooms_units', + 'base field' => 'unit_id', + 'field' => 'rooms_booked_unit_id_value', + 'label' => t('Booking unit'), + ); + } +} + /** * Implements hook_views_default_views(). */