You are here

public function RoomsUnitController::buildContent in Rooms - Drupal Booking for Hotels, B&Bs and Vacation Rentals 7

Overriding the buildContent function to add entity specific fields.

Overrides EntityAPIController::buildContent

File

modules/rooms_unit/rooms_unit.module, line 819
Manage units - Units are things that can be booked on a nightly basis (e.g. rooms - but also villas bungalows, etc).

Class

RoomsUnitController
The Controller for RoomsUnit entities

Code

public function buildContent($entity, $view_mode = 'full', $langcode = NULL, $content = array()) {
  $content = parent::buildContent($entity, $view_mode, $langcode, $content);
  $content['state'] = array(
    '#markup' => t('State') . ': ' . $entity->bookable . '<br/>',
  );
  $content['type'] = array(
    '#markup' => t('Type') . ': ' . $entity->type . '<br/>',
  );
  $content['sleeps'] = array(
    '#markup' => t('Sleeps') . ': ' . $entity->max_sleeps . '<br/>',
  );
  if (isset($entity->data['bed_arrangement'])) {
    $content['bed_arrangement'] = array(
      '#markup' => t('Double beds') . ': ' . $entity->data['bed_arrangement']['doubles'] . '<br/>' . t('Single beds') . ': ' . $entity->data['bed_arrangement']['singles'] . '<br/>',
    );
  }
  return $content;
}