‪TYPO3CMS  ‪main
TYPO3\CMS\Core\LinkHandling\LinkService Class Reference
Inheritance diagram for TYPO3\CMS\Core\LinkHandling\LinkService:
TYPO3\CMS\Core\SingletonInterface

Public Member Functions

 __construct ()
 
 resolve (string $linkParameter)
 
 resolveByStringRepresentation (string $urn)
 
 asString (array $parameters)
 

Public Attributes

const TYPE_PAGE = 'page'
 
const TYPE_INPAGE = 'inpage'
 
const TYPE_URL = 'url'
 
const TYPE_EMAIL = 'email'
 
const TYPE_TELEPHONE = 'telephone'
 
const TYPE_FILE = 'file'
 
const TYPE_FOLDER = 'folder'
 
const TYPE_RECORD = 'record'
 
const TYPE_UNKNOWN = 'unknown'
 

Protected Attributes

LinkHandlingInterface[] $handlers
 

Detailed Description

Class LinkService, responsible to find what kind of resource (type) is used to link to (email, external url, file, page etc) with the possibility to get a system-wide understandable "urn" to identify what type it actually is, based on the scheme or prefix.

Definition at line 34 of file LinkService.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Core\LinkHandling\LinkService::__construct ( )

LinkService constructor initializes the registered handlers.

Definition at line 55 of file LinkService.php.

References $GLOBALS.

Member Function Documentation

◆ asString()

TYPO3\CMS\Core\LinkHandling\LinkService::asString ( array  $parameters)

Returns a string interpretation of the link target, something like

Parameters
array$parameters
Exceptions
Exception

Definition at line 185 of file LinkService.php.

◆ resolve()

TYPO3\CMS\Core\LinkHandling\LinkService::resolve ( string  $linkParameter)

Part of the typolink construction functionality, called by typoLink() Used to resolve "legacy"-based typolinks and URNs.

Tries to get the type of the link from the link parameter could be

  • ‪"mailto" an email address
  • ‪"url" external URL
  • ‪"file" a local file (checked AFTER getPublicUrl() is called)
  • ‪"page" a page (integer)

Does NOT check if the page exists or the file exists.

Parameters
string$linkParameter‪could be "fileadmin/myfile.jpg", "info@typo3.org", "13" or "http://www.typo3.org"
Exceptions
UnknownLinkHandlerException

Definition at line 88 of file LinkService.php.

References TYPO3\CMS\Core\LinkHandling\LinkService\resolveByStringRepresentation().

◆ resolveByStringRepresentation()

TYPO3\CMS\Core\LinkHandling\LinkService::resolveByStringRepresentation ( string  $urn)

Member Data Documentation

◆ $handlers

LinkHandlingInterface [] TYPO3\CMS\Core\LinkHandling\LinkService::$handlers
protected

All registered LinkHandlers

Definition at line 50 of file LinkService.php.

◆ TYPE_EMAIL

◆ TYPE_FILE

◆ TYPE_FOLDER

◆ TYPE_INPAGE

const TYPO3\CMS\Core\LinkHandling\LinkService::TYPE_INPAGE = 'inpage'

◆ TYPE_PAGE

◆ TYPE_RECORD

◆ TYPE_TELEPHONE

◆ TYPE_UNKNOWN

◆ TYPE_URL

const TYPO3\CMS\Core\LinkHandling\LinkService::TYPE_URL = 'url'

Definition at line 38 of file LinkService.php.

Referenced by TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\_parseFuncReturnsCorrectHtmlDataProvider(), TYPO3\CMS\Frontend\Typolink\ExternalUrlLinkBuilder\build(), TYPO3\CMS\Frontend\Typolink\LegacyLinkBuilder\build(), TYPO3\CMS\Linkvalidator\EventListener\CheckBrokenRteLinkEventListener\checkExternalLink(), TYPO3\CMS\Core\LinkHandling\LegacyLinkNotationConverter\getFileOrFolderObjectFromMixedIdentifier(), TYPO3\CMS\Backend\Form\Element\LinkElement\getLinkExplanation(), TYPO3\CMS\Redirects\Tests\Unit\Service\RedirectServiceTest\getTargetUrlAddsExistingQueryParams(), TYPO3\CMS\Redirects\Tests\Unit\Service\RedirectServiceTest\getTargetUrlReplaceRegExpCaptureGroup(), TYPO3\CMS\Redirects\Tests\Unit\Service\RedirectServiceTest\getTargetUrlRespectsForceHttps(), TYPO3\CMS\Redirects\Tests\Unit\Service\RedirectServiceTest\getTargetUrlReturnsUrlForTypeUrl(), TYPO3\CMS\Redirects\Tests\Unit\Service\RedirectServiceTest\getTargetUrlWithQueryAndSlashReplaceRegExpCaptureGroup(), TYPO3\CMS\Redirects\Tests\Unit\Service\RedirectServiceTest\getTargetUrlWithQueryReplaceRegExpCaptureGroup(), TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentObjectRendererTest\httpMakelinksDataProvider(), TYPO3\CMS\Core\DataHandling\SoftReference\TypolinkTagSoftReferenceParser\parse(), TYPO3\CMS\Core\LinkHandling\LegacyLinkNotationConverter\resolve(), TYPO3\CMS\Core\LinkHandling\LinkService\resolveByStringRepresentation(), TYPO3\CMS\Redirects\Service\RedirectService\resolveLinkDetailsFromLinkTarget(), TYPO3\CMS\Core\Tests\Unit\LinkHandling\LinkServiceTest\resolveParametersForNonFilesDataProvider(), and TYPO3\CMS\Core\DataHandling\SoftReference\TypolinkSoftReferenceParser\setTypoLinkPartsElement().