\TYPO3\CMS\Frontend\Typolink\LinkFactory class is added to TYPO3
Core, which allows to generate any kind of links in the TYPO3 frontend - links
to files, pages, URLs, email, telephone links, or links to specific records,
such as news entries.
Previously, this functionality resided in
ContentObjectRenderer->typoLink_URL() but was extracted into a
specific class, only dealing with the generation of links.
This class works with two main methods:
Both methods return a
LinkResultInterface instance, which can be used
programmatically to render the results of the link generation for HTML output
LinkResult->getHtml() or as JSON with
For TypoScript or Fluid-based renderings, the base functionality for using
ContentObjectRenderer->typoLink() is still recommended. However, when
an extension developer wants to work with the raw result, the
LinkResultInterface and corresponding implementations for JSON and HTML
rendering allow for much more flexibility by accessing more information than
just the raw anchor tag.