protected function PhotosImage::urlRouteParameters in Album Photos 8.5
Same name and namespace in other branches
- 6.0.x src/Entity/PhotosImage.php \Drupal\photos\Entity\PhotosImage::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/
Entity/ PhotosImage.php, line 311
Class
- PhotosImage
- Defines the photos image entity class.
Namespace
Drupal\photos\EntityCode
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();
// Include album node ID.
$uri_route_parameters['node'] = $this
->getAlbumId();
}
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;
}