a7ec15ee905eb4033ca76a52125a6ee60da42e88
[yaffs-website] / web / modules / contrib / entity / src / Revision / RevisionableContentEntityBase.php
1 <?php
2
3 namespace Drupal\entity\Revision;
4
5 use Drupal\Core\Entity\RevisionableContentEntityBase as BaseRevisionableContentEntityBase;
6 use Drupal\Core\Entity\ContentEntityBase;
7
8 /**
9  * Improves the url route handling of core's revisionable content entity base.
10  */
11 abstract class RevisionableContentEntityBase extends BaseRevisionableContentEntityBase {
12
13   /**
14    * {@inheritdoc}
15    */
16   protected function urlRouteParameters($rel) {
17     $uri_route_parameters = [];
18
19     if ($rel != 'collection') {
20       // The entity ID is needed as a route parameter.
21       $uri_route_parameters[$this->getEntityTypeId()] = $this->id();
22     }
23     if (strpos($this->getEntityType()->getLinkTemplate($rel), $this->getEntityTypeId() . '_revision') !== FALSE) {
24       $uri_route_parameters[$this->getEntityTypeId() . '_revision'] = $this->getRevisionId();
25     }
26
27     return $uri_route_parameters;
28   }
29
30 }