function commerce_invoice_handler_field_invoice::render_link in Commerce Invoice 7
Render whatever the data is as a link to the invoice.
Data should be made XSS safe prior to calling this function.
1 call to commerce_invoice_handler_field_invoice::render_link()
- commerce_invoice_handler_field_invoice::render in includes/
views/ handlers/ commerce_invoice_handler_field_invoice.inc - Render the field.
File
- includes/
views/ handlers/ commerce_invoice_handler_field_invoice.inc, line 55 - Contains the basic invoice field handler.
Class
- commerce_invoice_handler_field_invoice
- Field handler to provide simple renderer that allows linking to an invoice.
Code
function render_link($data, $values) {
if (!empty($this->options['link_to_invoice']) && in_array($this->options['link_to_invoice'], array(
'customer',
'admin',
)) && $data !== NULL && $data !== '') {
$uid = $this
->get_value($values, 'uid');
$invoice_id = $this
->get_value($values, 'invoice_id');
$order_id = $this
->get_value($values, 'order_id');
if ($this->options['link_to_invoice'] == 'customer' && $uid) {
$this->options['alter']['make_link'] = TRUE;
$this->options['alter']['path'] = 'user/' . $uid . '/invoices/' . $invoice_id;
}
elseif ($this->options['link_to_invoice'] == 'admin') {
$this->options['alter']['make_link'] = TRUE;
$this->options['alter']['path'] = 'admin/commerce/orders/' . $order_id . '/invoice';
}
}
return $data;
}