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

Public Member Functions

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

Public Attributes

const TYPE_PAGE = 'page'
 
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 32 of file LinkService.php.

Constructor & Destructor Documentation

◆ __construct()

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

LinkService constructor initializes the registered handlers.

Definition at line 52 of file LinkService.php.

References $GLOBALS.

Member Function Documentation

◆ asString()

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

Returns a string interpretation of the link target, something like

Parameters
array$parameters
Returns
‪string
Exceptions
Exception

Definition at line 161 of file LinkService.php.

◆ resolve()

array 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"
Returns
‪array

Definition at line 79 of file LinkService.php.

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

◆ resolveByStringRepresentation()

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

Returns an array with data interpretation of the link target, something like t3://page?uid=23.

Parameters
string$urn
Returns
‪array
Exceptions
Exception

Definition at line 98 of file LinkService.php.

References $GLOBALS, TYPO3\CMS\Core\Utility\StringUtility\beginsWith(), TYPO3\CMS\Core\LinkHandling\LinkService\TYPE_EMAIL, TYPO3\CMS\Core\LinkHandling\LinkService\TYPE_TELEPHONE, and TYPO3\CMS\Core\LinkHandling\LinkService\TYPE_URL.

Referenced by TYPO3\CMS\Core\LinkHandling\LinkService\resolve().

Member Data Documentation

◆ $handlers

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

All registered LinkHandlers

Definition at line 47 of file LinkService.php.

◆ TYPE_EMAIL

◆ TYPE_FILE

◆ TYPE_FOLDER

◆ TYPE_PAGE

◆ TYPE_RECORD

◆ TYPE_TELEPHONE

◆ TYPE_UNKNOWN

◆ TYPE_URL