protected Entity::urlRouteParameters($rel)
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.
string $rel: The link relationship type, for example: canonical or edit-form.
array An array of URI placeholders.
protected function urlRouteParameters($rel) { $uri_route_parameters = []; if (!in_array($rel, ['collection', 'add-page', 'add-form'], TRUE)) { // The entity ID is needed as a route parameter. $uri_route_parameters[$this->getEntityTypeId()] = $this->id(); } if ($rel === 'add-form' && ($this->getEntityType()->hasKey('bundle'))) { $parameter_name = $this->getEntityType()->getBundleEntityType() ? : $this->getEntityType()->getKey('bundle'); $uri_route_parameters[$parameter_name] = $this->bundle(); } if ($rel === 'revision' && $this instanceof RevisionableInterface) { $uri_route_parameters[$this->getEntityTypeId() . '_revision'] = $this->getRevisionId(); } return $uri_route_parameters; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Entity!Entity.php/function/Entity::urlRouteParameters/8.1.x