You are here

function rooms_unit_handler_delete_link_field::render in Rooms - Drupal Booking for Hotels, B&Bs and Vacation Rentals 7

Render the field.

Parameters

array $values: The values retrieved from the database.

Overrides rooms_unit_handler_link_field::render

File

modules/rooms_unit/views/rooms_unit_handler_delete_link_field.inc, line 16
Contains a Views field handler to take care of displaying deletes links as fields.

Class

rooms_unit_handler_delete_link_field
@file Contains a Views field handler to take care of displaying deletes links as fields.

Code

function render($values) {
  $type = $values->{$this->aliases['type']};

  // Creating a dummy room to check access against.
  $dummy_unit = (object) array(
    'type' => $type,
  );
  if (!rooms_unit_access('delete', $dummy_unit)) {
    return;
  }
  $text = !empty($this->options['text']) ? $this->options['text'] : t('delete');
  $unit_id = $values->{$this->aliases['unit_id']};
  return l($text, 'admin/rooms/units/unit/' . $unit_id . '/delete');
}