Project

General

Profile

Actions

Feature #94086

open

Softref for custom linkhandler

Added by Philipp Kitzberger about 3 years ago. Updated 12 months ago.

Status:
Needs Feedback
Priority:
Should have
Assignee:
-
Category:
Linkvalidator
Target version:
-
Start date:
2021-05-07
Due date:
% Done:

0%

Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

In our project we've got a custom linkhandler set up that works with external entities and the following link format: t3 ://foo?subtype=bar&identifier=123

Just to be clear: it's not a record linkhandler!

When trying to config the EXT:linkvalidator we've noticed that it uses the "softref index" to identify the links to be validated.

tt_content.bodytext is configured via TCA to have this softref configuration: typolink_tag,email[subst],url

In \TYPO3\CMS\Core\Database\SoftReferenceIndex::findRef_typolink_tag only these types seem to be processed though:

if ($linkDetails['type'] === LinkService::TYPE_FILE && preg_match('/file\?uid=(\d+)/', $matches[1], $fileIdMatch)) {
    ...
} elseif ($linkDetails['type'] === LinkService::TYPE_PAGE && preg_match('/page\?uid=(\d+)#?(\d+)?/', $matches[1], $pageAndAnchorMatches)) {
    ...    
} elseif ($linkDetails['type'] === LinkService::TYPE_URL) {
    ...
} elseif ($linkDetails['type'] === LinkService::TYPE_EMAIL) {
    ...
} elseif ($linkDetails['type'] === LinkService::TYPE_TELEPHONE) {
    ...
}

Am I right that LinkService::TYPE_RECORD and our custom linkhandler is not being processed at the moment? Just to be sure before investing time and creating a patch ;-)


Files

patch (2.17 KB) patch corbet dynie, 2022-03-11 15:24

Related issues 3 (3 open0 closed)

Related to TYPO3 Core - Task #96110: Clarify usage of custom linkhandler functionality in redirects moduleNewSybille Peters2021-11-27

Actions
Related to TYPO3 Core - Bug #102468: Linkvalidator doesn't check record/custom links within RTEs at allNew2023-11-22

Actions
Related to TYPO3 Core - Feature #103403: Make it possible to check custom record links with linkvalidatorUnder ReviewSybille Peters2024-03-15

Actions
Actions #1

Updated by Philipp Kitzberger about 3 years ago

  • Tracker changed from Bug to Feature
  • TYPO3 Version deleted (10)
Actions #2

Updated by Benni Mack over 2 years ago

  • Status changed from New to Needs Feedback

Hey Philipp,

the SoftRefParser has now been completely refactored and is now fully extendable (v11). Can you check if you can now integrate custom Link Handler checks?

Actions #3

Updated by corbet dynie over 2 years ago

  • File patch added
Actions #4

Updated by corbet dynie over 2 years ago

I had the same problem with v10.4 and I think it is a bug.
All soft reference parsers take care of records except typolink_tag.

Actions #5

Updated by corbet dynie over 2 years ago

  • File deleted (patch)
Actions #6

Updated by Oliver Weiss about 2 years ago

corbet dynie wrote in #note-4:

I had the same problem with v10.4 and I think it is a bug.
All soft reference parsers take care of records except typolink_tag.

I can confirm this. records are not checked by linkvalidator. I think, this is a must-have.

Actions #7

Updated by Riccardo De Contardi almost 2 years ago

  • Status changed from Needs Feedback to New
Actions #8

Updated by Philipp Kitzberger over 1 year ago

Can you check if you can now integrate custom Link Handler checks?

Thanks, Benni! With the TYPO3 11 implementation of the linkvalidator it was now possible to implement handling for our custom typolink format.

To cover all cases (links within tt_content.bodytext and dedicated link fields such as tt_content.header_link) I had to implement the following:

EXT:my_extension/ext_localconf.php

$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks']['custom'] = \MyVendor\MyExtension\LinkValidation\CustomUriValidator::class;

EXT:my_extension/Configuration/TCA/Overrides/tt_content.php

$GLOBALS['TCA']['tt_content']['columns']['bodytext']['config']['softref'] .= ',custom';
$GLOBALS['TCA']['tt_content']['columns']['header_link']['config']['softref'] .= ',custom';

EXT:my_extension/Configuration/Services.yaml

services:
  MyVendor\MyExtension\LinkValidation\CustomUriResolver:
    tags:
      - name: event.listener
        event: TYPO3\CMS\Core\DataHandling\Event\AppendLinkHandlerElementsEvent

  MyVendor\MyExtension\LinkValidation\CustomUriParser:
    tags:
      - name: softreference.parser
        parserKey: custom

Actions #9

Updated by Benni Mack 12 months ago

  • Status changed from New to Needs Feedback

so the only thing now is to create a custom linkvalidator now? Or is something missing with v11? Or maybe just documentation?

Actions #10

Updated by Benni Mack 12 months ago

  • Related to Task #96110: Clarify usage of custom linkhandler functionality in redirects module added
Actions #11

Updated by Philipp Kitzberger 12 months ago

@Benni Mack, yeah, maybe it's just documentation now that's missing. I'm often confused about the docs on these topics to be honest. Linkhandler vs. linkbrowser vs. linkvalidator. I guess the chapter on custom linkvalidators is missing completely? https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ApiOverview/LinkHandling/Index.html

Actions #13

Updated by Philipp Kitzberger 12 months ago

@Lina Wolf, nope, I'm talking about a chapter on "link validation" (which I cannot find in the docs)

Actions #14

Updated by Sybille Peters 3 months ago

  • Related to Bug #102468: Linkvalidator doesn't check record/custom links within RTEs at all added
Actions #15

Updated by Sybille Peters 3 months ago

  • Related to Feature #103403: Make it possible to check custom record links with linkvalidator added
Actions

Also available in: Atom PDF