function _rooms_booking_manager_load_description in Rooms - Drupal Booking for Hotels, B&Bs and Vacation Rentals 7
Checks to see if an entity type has a node associated with it and loads the description of that node.
Parameters
$form:
$type_obj:
$type:
$price:
Return value
mixed
1 call to _rooms_booking_manager_load_description()
- book_units_per_type_form in modules/
rooms_booking_manager/ rooms_booking_manager.module - Book units per type booking form callback.
File
- modules/
rooms_booking_manager/ rooms_booking_manager.units_per_type_form.inc, line 53 - Helper functions to clear up the units per type form and make the logic easier to follow.
Code
function _rooms_booking_manager_load_description($form, $type_obj, $type, $price) {
// Check if a description source is loaded and render it if so.
if (isset($type_obj->data['rooms_description_source'])) {
if ($type_obj->data['rooms_description_source'] != '') {
$source_ref = explode(':', $type_obj->data['rooms_description_source']);
if (isset($source_ref[1])) {
$node_id = $source_ref[1];
if (module_exists('translation')) {
$node_translations = translation_node_get_translations($node_id);
if (!empty($node_translations)) {
$node_id = $node_translations[$GLOBALS['language']->language]->nid;
}
}
if ($node = node_load($node_id)) {
$node_view = node_view($node, 'rooms_list');
$node_html = render($node_view);
$form[$type][$price]['description'] = array(
'#prefix' => '<tr class="rooms-search-result__unit_details_wrapper"><td class="rooms-search-result__room-description">',
'#markup' => $node_html,
'#suffix' => '</td><td class="empty"></td><td class="empty"></td></tr>',
);
}
}
}
}
return $form;
}