public function MediaFileRedirect::getUrl in Media Entity File Redirect 8
Get the URL associated with a given entity.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity to get a URL for.
Return value
\Drupal\Core\GeneratedUrl A url to replace.
Overrides SubstitutionInterface::getUrl
File
- src/
Plugin/ Linkit/ Substitution/ MediaFileRedirect.php, line 24
Class
- MediaFileRedirect
- A substitution plugin for the URL to a file associated with a media entity.
Namespace
Drupal\media_entity_file_redirect\Plugin\Linkit\SubstitutionCode
public function getUrl(EntityInterface $entity) {
return Url::fromRoute('media_entity_file_redirect.file_redirect', [
'media' => $entity
->id(),
])
->toString(TRUE);
}