You are here

protected function GroupContent::urlRouteParameters in Group 8

Same name and namespace in other branches
  1. 2.0.x src/Entity/GroupContent.php \Drupal\group\Entity\GroupContent::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/GroupContent.php, line 138

Class

GroupContent
Defines the Group content entity.

Namespace

Drupal\group\Entity

Code

protected function urlRouteParameters($rel) {
  $uri_route_parameters = parent::urlRouteParameters($rel);
  $uri_route_parameters['group'] = $this
    ->getGroup()
    ->id();

  // These routes depend on the plugin ID.
  if (in_array($rel, [
    'add-form',
    'create-form',
  ])) {
    $uri_route_parameters['plugin_id'] = $this
      ->getContentPlugin()
      ->getPluginId();
  }
  return $uri_route_parameters;
}