You are here

protected function ShipmentId::renderLink in Ubercart 8.4

Renders whatever the data is as a link to the order.

Data should be made XSS safe prior to calling this function.

1 call to ShipmentId::renderLink()
ShipmentId::render in shipping/uc_fulfillment/src/Plugin/views/field/ShipmentId.php
Renders the field.

File

shipping/uc_fulfillment/src/Plugin/views/field/ShipmentId.php, line 60

Class

ShipmentId
Field handler: simple renderer that links to the shipment page.

Namespace

Drupal\uc_fulfillment\Plugin\views\field

Code

protected function renderLink($data, $values) {
  if (!empty($this->options['link_to_shipment'])) {
    $this->options['alter']['make_link'] = FALSE;
    if (\Drupal::currentUser()
      ->hasPermission('fulfill orders')) {
      $path = 'admin/store/orders/' . $this
        ->get_value($values, 'order_id') . '/shipments/' . $values->{$this->field_alias};
    }
    else {
      $path = FALSE;
    }
    if ($path && $data !== NULL && $data !== '') {
      $this->options['alter']['make_link'] = TRUE;
      $this->options['alter']['path'] = $path;
    }
  }
  return $data;
}