public function bat_type_handler_delete_link_field::render in Booking and Availability Management Tools for Drupal 7
Render the field.
Parameters
array $values: The values retrieved from the database.
Overrides bat_type_handler_link_field::render
File
- modules/
bat_unit/ views/ bat_type_handler_delete_link_field.inc, line 25 - Contains a Views field handler to take care of displaying deletes links as fields.
Class
Code
public function render($values) {
$type = $values->{$this->aliases['type']};
// Creating a dummy type to check access against.
$dummy_type = bat_type_create(array(
'type' => $type,
));
if (!bat_type_access('delete', $dummy_type)) {
return;
}
$text = !empty($this->options['text']) ? $this->options['text'] : t('delete');
$type_id = $values->{$this->aliases['type_id']};
$options = array();
if (!empty($this->options['destination'])) {
$options = array(
'query' => drupal_get_destination(),
);
}
return l($text, 'admin/bat/config/types/manage/' . $type_id . '/delete', $options);
}