TYPO3-Documentation / Changelog-To-Doc

1 stars 0 forks source link

[FEATURE] Move LinkResultFactory functionality into LinkFactory #229

Open TYPO3IncTeam opened 2 years ago

TYPO3IncTeam commented 2 years ago

:information_source: View this commit on Github :busts_in_silhouette: Authored by Benni Mack benni@typo3.org :heavy_check_mark: Merged by Oliver Hader oliver.hader@typo3.org

Commit message

[FEATURE] Move LinkResultFactory functionality into LinkFactory

The newly introduced LinkFactory is the main entrypoint for generating links. It can now be used to generate URLs, also in TYPO3 Backend (such as for sys_news RTE fields).

The LinkResultFactory functionality has now been merged into LinkFactory, making LinkFactory the de-facto standard for generating links.

A Feature RST is added to explain the new functionality.

A class alias as well as an alias in the service configuration is added to have LinkResultFactory still working in TYPO3 v12.

Resolves: #97536 Releases: main Change-Id: I62ef49a3ac811e93e2fa52ec52b1fb429aed0259 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/74374 Tested-by: Oliver Bartsch bo@cedev.de Tested-by: core-ci typo3@b13.com Tested-by: Oliver Hader oliver.hader@typo3.org Reviewed-by: Oliver Bartsch bo@cedev.de Reviewed-by: Oliver Hader oliver.hader@typo3.org

:heavy_plus_sign: Added files

12.1/Deprecation-97536-LinkResultFactory.rst ```rst .. include:: /Includes.rst.txt .. _deprecation-97536-1651523804 ======================================= Deprecation: #97536 - LinkResultFactory ======================================= See :issue:`97536` Description =========== The PHP class :php:`TYPO3\CMS\Frontend\Typolink\LinkResultFactory` has been marked as deprecated, as its functionality has been migrated into :php:`TYPO3\CMS\Frontend\Typolink\LinkFactory`. In addition, the method :php:`createFromUriString()` has been marked as deprecated as the shortened variant `createUri()` should be used instead. Impact ====== Instantiating an object of type :php:`LinkResultFactory` will instantiate :php:`LinkFactory` instead via class alias in TYPO3 v12, as the class itself has been removed. Calling :php:`createFromUriString()` will trigger a deprecation log entry. The extension scanner reports affected extensions. Affected installations ====================== TYPO3 installations with custom extensions instantiating :php:`LinkResultFactory` as a PHP object or calling :php:`createFromUriString()` directly, which is very rare. Migration ========= TYPO3 extensions should migrate to using :php:`LinkFactory` and its main methods directly. .. index:: Frontend, PHP-API, FullyScanned, ext:frontend ```
12.1/Feature-97536-UnifiedAPIForGeneratingTypolinks.rst ```rst .. include:: /Includes.rst.txt .. _feature-97536-1651523601 ====================================================== Feature: #97536 - Unified API for generating typolinks ====================================================== See :issue:`97536` Description =========== A new :php:`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 :php:`ContentObjectRenderer->typoLink()` and :php:`ContentObjectRenderer->typoLink_URL()` but was extracted into a specific class, only dealing with the generation of links. This class works with two main methods: :php:`LinkFactory->create()` :php:`LinkFactory->createUri()` Both methods return a :php:`LinkResultInterface` instance, which can be used programmatically to render the results of the link generation for HTML output via :php:`LinkResult->getHtml()` or as JSON with :php:`LinkResult->getJson()`. Impact ====== For TypoScript- or Fluid-based renderings, the base functionality for using :php:`ContentObjectRenderer->typoLink()` is still recommended. However, when an extension developer wants to work with the raw result, the :php:`LinkResultInterface` and corresponding implementations for JSON and HTML rendering allow for much more flexibility by accessing more information than just the raw anchor tag. .. index:: Frontend, PHP-API, ext:frontend ```
linawolf commented 1 year ago

@brotkrueml are you still working on this feature?

brotkrueml commented 1 year ago

Not for the foreseeable future, feel free to take over.