You are here

protected function Entity::urlRouteParameters in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Entity/Entity.php \Drupal\Core\Entity\Entity::urlRouteParameters()

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.

2 calls to Entity::urlRouteParameters()
Entity::toUrl in core/lib/Drupal/Core/Entity/Entity.php
Gets the URL object for the entity.
FieldConfig::urlRouteParameters in core/modules/field/src/Entity/FieldConfig.php
Gets an array of placeholders for this entity.
1 method overrides Entity::urlRouteParameters()
FieldConfig::urlRouteParameters in core/modules/field/src/Entity/FieldConfig.php
Gets an array of placeholders for this entity.

File

core/lib/Drupal/Core/Entity/Entity.php, line 307
Contains \Drupal\Core\Entity\Entity.

Class

Entity
Defines a base entity class.

Namespace

Drupal\Core\Entity

Code

protected function urlRouteParameters($rel) {
  $uri_route_parameters = [];
  if ($rel != 'collection') {

    // The entity ID is needed as a route parameter.
    $uri_route_parameters[$this
      ->getEntityTypeId()] = $this
      ->id();
  }
  if ($rel === 'revision') {
    $uri_route_parameters[$this
      ->getEntityTypeId() . '_revision'] = $this
      ->getRevisionId();
  }
  return $uri_route_parameters;
}