You are here

public function EntityDuplicateController::title in Entity API 8

Provides the duplicate form title.

Parameters

\Drupal\Core\Routing\RouteMatchInterface $route_match: The route match.

Return value

string The duplicate form title.

File

src/Controller/EntityDuplicateController.php, line 102

Class

EntityDuplicateController

Namespace

Drupal\entity\Controller

Code

public function title(RouteMatchInterface $route_match) {
  $entity_type_id = $route_match
    ->getRouteObject()
    ->getDefault('entity_type_id');
  $source_entity = $route_match
    ->getParameter($entity_type_id);
  $source_entity = $this->entityRepository
    ->getTranslationFromContext($source_entity);
  return $this
    ->t('Duplicate %label', [
    '%label' => $source_entity
      ->label(),
  ]);
}