You are here

protected function RevisionableContentEntityBase::urlRouteParameters in Entity API 8.0

Same name and namespace in other branches
  1. 8 src/Revision/RevisionableContentEntityBase.php \Drupal\entity\Revision\RevisionableContentEntityBase::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.

Overrides EntityBase::urlRouteParameters

File

src/Revision/RevisionableContentEntityBase.php, line 20
Contains \Drupal\entity\Revision\RevisionableContentEntityBase.

Class

RevisionableContentEntityBase
Provides an entity class with revisions.

Namespace

Drupal\entity\Revision

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 (strpos($this
    ->getEntityType()
    ->getLinkTemplate($rel), $this
    ->getEntityTypeId() . '_revision') !== FALSE) {
    $uri_route_parameters[$this
      ->getEntityTypeId() . '_revision'] = $this
      ->getRevisionId();
  }
  return $uri_route_parameters;
}