function EntityTypeInfo::setEntityTypeLinkTemplate

Same name in other branches
  1. 4.x src/EntityTypeInfo.php \Drupal\devel\EntityTypeInfo::setEntityTypeLinkTemplate()

Sets entity type link template.

Parameters

\Drupal\Core\Entity\EntityTypeInterface $entity_type: Entity type.

string $entity_link: Entity link.

string $devel_link_key: Devel link key.

string $base_path: Base path for devel link key.

1 call to EntityTypeInfo::setEntityTypeLinkTemplate()
EntityTypeInfo::entityTypeAlter in src/EntityTypeInfo.php
Adds devel links to appropriate entity types.

File

src/EntityTypeInfo.php, line 95

Class

EntityTypeInfo
Manipulates entity type information.

Namespace

Drupal\devel

Code

protected function setEntityTypeLinkTemplate(EntityTypeInterface $entity_type, $entity_link, $devel_link_key, string $base_path) {
    // Extract all route parameters from the given template and set them to
    // the current template.
    // Some entity templates can contain not only entity id,
    // for example /user/{user}/documents/{document}
    // /group/{group}/content/{group_content}
    // We use canonical or edit-form templates to get these parameters and set
    // them for devel entity link templates.
    $path_parts = $this->getPathParts($entity_link);
    $entity_type->setLinkTemplate($devel_link_key, $base_path . $path_parts);
}