You are here

RevisionableContentEntityBase.php in Entity API 8.0

Same filename and directory in other branches
  1. 8 src/Revision/RevisionableContentEntityBase.php

File

src/Revision/RevisionableContentEntityBase.php
View source
<?php

/**
 * @file
 * Contains \Drupal\entity\Revision\RevisionableContentEntityBase.
 */
namespace Drupal\entity\Revision;

use Drupal\Core\Entity\ContentEntityBase;

/**
 * Provides an entity class with revisions.
 */
abstract class RevisionableContentEntityBase extends ContentEntityBase {

  /**
   * {@inheritdoc}
   */
  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;
  }

}

Classes

Namesort descending Description
RevisionableContentEntityBase Provides an entity class with revisions.