function commerce_cardonfile_handler_field_card_operations::render in Commerce Card on File 7.2
Render the field.
Parameters
array $values: The values retrieved from the database.
Overrides views_handler_field::render
File
- includes/
views/ handlers/ commerce_cardonfile_handler_field_card_operations.inc, line 37
Class
- commerce_cardonfile_handler_field_card_operations
- Field handler to present a card data's operations links.
Code
function render($values) {
$card_id = $this
->get_value($values, 'card_id');
$card = commerce_cardonfile_load($card_id);
$uid = $this
->get_value($values, 'uid');
// Get the operations links.
// Hardcoded because the Edit and Delete links are not under a common
// parent, to allow methods to provide delete functionality without
// providing edit functionality.
$links = array(
'commerce-cardonfile-edit' => array(
'title' => t('Edit'),
'href' => 'user/' . $uid . '/cards/' . $card_id . '/edit',
'access' => commerce_cardonfile_access('update', $card),
),
'commerce-cardonfile-delete' => array(
'title' => t('Delete'),
'href' => 'user/' . $uid . '/cards/' . $card_id . '/delete',
'access' => commerce_cardonfile_access('delete', $card),
),
);
foreach ($links as $id => &$link) {
if (!$link['access']) {
unset($links[$id]);
}
elseif ($this->options['add_destination']) {
$link['query'] = drupal_get_destination();
}
}
if (!empty($links)) {
drupal_add_css(drupal_get_path('module', 'commerce_cardonfile') . '/theme/commerce_cardonfile.admin.css');
return theme('links', array(
'links' => $links,
'attributes' => array(
'class' => array(
'links',
'inline',
'operations',
),
),
));
}
}