You are here

protected function Wishlist::urlRouteParameters in Commerce Wishlist 8.3

Gets an array of placeholders for this entity.

Individual entity classes may override this method to add additional placeholders if desired. If so, they should be sure to replicate the property caching logic.

Parameters

string $rel: The link relationship type, for example: canonical or edit-form.

Return value

array An array of URI placeholders.

Overrides EntityBase::urlRouteParameters

File

src/Entity/Wishlist.php, line 127

Class

Wishlist
Defines the wishlist entity class.

Namespace

Drupal\commerce_wishlist\Entity

Code

protected function urlRouteParameters($rel) {
  if (in_array($rel, [
    'user-form',
    'share-form',
  ])) {
    return [
      'user' => $this
        ->getOwnerId(),
      'code' => $this
        ->getCode(),
    ];
  }
  else {
    return parent::urlRouteParameters($rel);
  }
}