You are here

protected function EntityExtraField::urlRouteParameters in Entity Extra Field 8

Same name and namespace in other branches
  1. 2.0.x src/Entity/EntityExtraField.php \Drupal\entity_extra_field\Entity\EntityExtraField::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

1 call to EntityExtraField::urlRouteParameters()
EntityExtraField::toUrl in src/Entity/EntityExtraField.php
Gets the URL object for the entity.

File

src/Entity/EntityExtraField.php, line 394

Class

EntityExtraField
Define entity extra field.

Namespace

Drupal\entity_extra_field\Entity

Code

protected function urlRouteParameters($rel) {
  $base_bundle_type_id = $this
    ->getBaseEntityTypeBundle()
    ->id();
  $uri_route_parameters = [];
  $uri_route_parameters[$base_bundle_type_id] = $this
    ->getBaseBundleTypeId();
  switch ($rel) {
    case 'edit-form':
    case 'delete-form':
      $uri_route_parameters[$this
        ->getEntityTypeId()] = $this
        ->id();
      break;
  }
  return $uri_route_parameters;
}