You are here

function commerce_product_handler_field_product_link_edit::render in Commerce Core 7

Render the field.

Parameters

array $values: The values retrieved from the database.

Overrides commerce_product_handler_field_product_link::render

File

modules/product/includes/views/handlers/commerce_product_handler_field_product_link_edit.inc, line 14

Class

commerce_product_handler_field_product_link_edit
Field handler to present a product edit link.

Code

function render($values) {

  // Ensure the user has access to edit this product.
  $product = commerce_product_new();
  $product->product_id = $this
    ->get_value($values, 'product_id');
  $product->type = $this
    ->get_value($values, 'type');
  $product->uid = $this
    ->get_value($values, 'uid');
  if (!commerce_product_access('update', $product)) {
    return;
  }
  $text = !empty($this->options['text']) ? $this->options['text'] : t('edit');
  return l($text, 'admin/commerce/products/' . $product->product_id . '/edit', array(
    'query' => drupal_get_destination(),
  ));
}