InternalLinktype

class \TYPO3\CMS\Linkvalidator\Linktype\InternalLinktype

Extends
AbstractLinktype

This class checks internal links (links to database records), but only links to pages (including links to content elements in the URL fragment).

The actual format of the link is irrelevant, checked is the result returned by the configured softref parsers, but typically, the link target look like this:

  • t3://page?uid=123
  • t3://page?uid=123&_language=1
  • t3://page?uid=123#c43

Tags

todo

Makes sense to rename this to PageLinktype for more clarity

Table of Contents

Constants

DELETED  : string = 'deleted'
HIDDEN  : string = 'hidden'
MOVED  : string = 'moved'
NOTEXISTING  : string = 'notExisting'

Properties

$errorParams  : array
Contains parameters needed for the rendering of the error message
$identifier  : string
$responseContent  : bool
Result of the check, if the current content uid is valid or not
$responsePage  : bool
Result of the check, if the current page uid is valid or not

Methods

checkLink()  : bool
Checks a given URL + /path/filename.ext for validity
fetchType()  : string
Type fetching method, based on the type that softRefParserObj returns.
getBrokenUrl()  : string
Constructs a valid Url for browser output
getErrorMessage()  : string
Generates the localized error message from the error params saved from the parsing
getErrorParams()  : array
Get the value of the private property errorParams
getIdentifier()  : string
Returns the unique identifier of the linktype
getReadableName()  : string
Get localized label for this linktype to be displayed in Backend user interface.
setAdditionalConfig()  : void
Function to override config of Linktype. Should be used only if necessary. Add additional configuration to TSconfig.
checkContent()  : bool
Checks a given content uid for validity
checkPage()  : bool
Checks a given page uid for validity
getLanguageService()  : LanguageService
setErrorParams()  : mixed
Set the value of the protected property errorParams

Constants

NOTEXISTING

public string NOTEXISTING = 'notExisting'

Properties

$errorParams

Contains parameters needed for the rendering of the error message

protected array $errorParams = []

$identifier

protected string $identifier = 'db'

$responseContent

Result of the check, if the current content uid is valid or not

protected bool $responseContent = true

$responsePage

Result of the check, if the current page uid is valid or not

protected bool $responsePage = true

Methods

Checks a given URL + /path/filename.ext for validity

public checkLink(string $url, array $softRefEntry, LinkAnalyzer $reference) : bool

Parameters

$url : string

Url to check as page-id or page-id#anchor (if anchor is present)

$softRefEntry : array

The soft reference entry which builds the context of that url

$reference : LinkAnalyzer

Parent instance

Return values

bool —

TRUE on success or FALSE on error

fetchType()

Type fetching method, based on the type that softRefParserObj returns.

public fetchType(array $value, string $type, string $key) : string

Parameters

$value : array

Reference properties

$type : string

Current type

$key : string

Validator hook name

Return values

string —

Fetched type

getBrokenUrl()

Constructs a valid Url for browser output

public getBrokenUrl(array $row) : string

Parameters

$row : array

Broken link record

Return values

string —

Parsed broken url

getErrorMessage()

Generates the localized error message from the error params saved from the parsing

public getErrorMessage(array $errorParams) : string

Parameters

$errorParams : array

All parameters needed for the rendering of the error message

Return values

string —

Validation error message

getErrorParams()

Get the value of the private property errorParams

public getErrorParams() : array

Return values

array —

All parameters needed for the rendering of the error message

getIdentifier()

Returns the unique identifier of the linktype

public getIdentifier() : string

Return values

string

getReadableName()

Get localized label for this linktype to be displayed in Backend user interface.

public getReadableName() : string

Custom Linktypes should override this and provide language labels for their type.

Return values

string

setAdditionalConfig()

Function to override config of Linktype. Should be used only if necessary. Add additional configuration to TSconfig.

public setAdditionalConfig(array $config) : void

Parameters

$config : array

checkContent()

Checks a given content uid for validity

protected checkContent(int $page, int $anchor) : bool

Parameters

$page : int

Uid of the page to which the link is pointing

$anchor : int

Uid of the content element to check

Return values

bool —

TRUE on success or FALSE on error

checkPage()

Checks a given page uid for validity

protected checkPage(int $page) : bool

Parameters

$page : int

Page uid to check

Return values

bool —

TRUE on success or FALSE on error

setErrorParams()

Set the value of the protected property errorParams

protected setErrorParams(array $value) : mixed

Parameters

$value : array

All parameters needed for the rendering of the error message

On this page