function rooms_unit_handler_edit_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_edit_link_field.inc, line 16 - Contains a Views field handler to take care of displaying edit links as fields.
Class
- rooms_unit_handler_edit_link_field
- @file Contains a Views field handler to take care of displaying edit links as fields.
Code
function render($values) {
$type = $values->{$this->aliases['type']};
// Creating a dummy unit to check access against.
$dummy_unit = (object) array(
'type' => $type,
);
if (!rooms_unit_access('update', $dummy_unit)) {
return;
}
$text = !empty($this->options['text']) ? $this->options['text'] : t('edit');
$unit_id = $values->{$this->aliases['unit_id']};
return l($text, 'admin/rooms/units/unit/' . $unit_id . '/edit');
}