You are here

rooms_booking_handler_edit_link_field.inc in Rooms - Drupal Booking for Hotels, B&Bs and Vacation Rentals 7

Contains a Views field handler to take care of displaying edit links as fields

File

modules/rooms_booking/views/rooms_booking_handler_edit_link_field.inc
View source
<?php

/**
 * @file
 * Contains a Views field handler to take care of displaying edit links
 * as fields
 */
class rooms_booking_handler_edit_link_field extends rooms_booking_handler_link_field {
  function construct() {
    parent::construct();
    $this->additional_fields['type'] = 'type';
  }
  function render($values) {
    $type = $values->{$this->aliases['type']};

    //Creating a dummy booking to check access against
    $dummy_booking = (object) array(
      'type' => $type,
    );
    if (!rooms_booking_access('update', $dummy_booking)) {
      return;
    }
    $text = !empty($this->options['text']) ? $this->options['text'] : t('edit');
    $booking_id = $values->{$this->aliases['booking_id']};
    return l($text, 'admin/rooms/bookings/booking/' . $booking_id . '/edit');
  }

}

Classes

Namesort descending Description
rooms_booking_handler_edit_link_field @file Contains a Views field handler to take care of displaying edit links as fields