Issue Bug Resolved

#89182Linkvalidator should only check relevant fields in table

Sybille Peters 09/16/19, 17:48 updated 09/23/26, 13:20

Description

Some checks should only be performed if content is relevant. Additionally, the type ($GLOBALS[‘TCA’][$table][‘columns’][$field][‘config’][‘type’]) / softref configuration may change due to columnsOverrides

Currently, no TCA processing is performed, so this is not taken into account.

The problem is currently, if page or content element types are changed, the content is not removed from the fields which are now no longer relevant, so in older sites where this had been changed, you may get a lot of “broken links” for content that is not rendered in FE and is irrelevant.

Long term we would also like to be able to check flexform fields, so this should be considered as well.

Examples

  • type * tt_content.bodytext : depends on ctype (e.g. is usually not relevant for plugins or header) * pages.url : depends on doktype
  • displayCond * whether field is displayed in BE or not can depend on several conditions
  • overrideChildTca ?

why is this a problem

  • broken links in fields which are not relevant are checked (e.g. due to type, displayCond, etc.)
  • broken links are displayed in list, but editor gets error message or blank page when clicking pencil
  • which softref parsers are used depends on the type of the field. One field may have different types depending on context (e.g. type of record)

Reproduce

  1. Create a content element, e.g. “text & media”
  2. Add a broken link to the content (tt_content.bodytext)
  3. Now change the content type, e.g. to plugin or header
  4. We recheck for broken links for that page
  5. We look at linkvalidator report

Actual result: The broken link will be displayed

Expected result: The broken link in the element “plugin” should not be displayed, because tt_content.bodytext is not relevant if content type is plugin

Possible solution

It should be possible to get the information, which fields are editable via TCA: ‘interface’ => ‘showRecordFieldList’.

Additionally, the type should be evaluated (e.g. tt_content.CType, pages.doktype, based on $GLOBALS[‘TCA’][$table][‘ctrl’][‘type’].

How to handle this, e.g.

  1. do TCA processing in Link Validator
  2. alternative: have “cleanup” script which removes irrelevant content (e.g. as in lowlevel cleaner Flexform cleanup). However, columnsOverrides should still be performed to get the correct type.

Reviews 2

History 1542

Show 917 earlier messages
  1. Sybille Peters changed subject Extend TSconfig configuration to allow restrictions (where) for fields Linkvalidator should only check relevant fields in table <span data-processor="relativetime" data-value="2019-11-10T09:04:02+00:00" > 11/10/19, 09:04 </span>

  2. Sybille Peters changed tracker Feature Bug description TYPO3 Version 9 <span data-processor="relativetime" data-value="2020-10-22T16:00:41+00:00" > 10/22/20, 16:00 </span>

  3. Gerrit Code Review pushed patch set 3 for master to change 66651 status New Under Review <span data-processor="relativetime" data-value="2020-11-22T18:57:12+00:00" > 11/22/20, 18:57 </span>

  1. Sybille Peters commented <span data-processor="relativetime" data-value="2024-03-18T11:08:54+00:00" > 03/18/24, 11:08 </span>

    Update:

    It is currently not possible to use the FormDataGroup TcaDatabaseRecord in order to get a list of fields which will be displayed in the BE.

    Linkvalidator should get the visible fields in the BE so that only these will be checked (and not for example the “bodytext” field for a CE type “header”, where links exist in bodytext but the type was changed).

    In order to determine the visible fields for a form in the BE, one can theoretically use FormEngine data processing, e.g.

    $formDataGroup = GeneralUtility::makeInstance(TcaDatabaseRecord::class);
    $this->formDataCompiler = GeneralUtility::makeInstance(FormDataCompiler::class, $formDataGroup);
    $formDataCompilerInput = [
        'tableName' => $tablename,
        'vanillaUid' => $uid,
        'command' => 'edit',
        'request' => $request;
    ];
    $processedFormData = $this->formDataCompiler->compile($formDataCompilerInput);
    $fields = $processedFormData['processedTca']['columns'];

    This almost works, but we have a problem: For example if CType=“header”, the returned fields contain “bodytext” because this is set in TcaColumnsProcessRecordTitle. Problably, there are other cases where some fields are added to columnsToProcess and processedTca/columns which should not be displayed in the BE form.

    The relevant classes are:

    - TcaColumnsProcessShowitem: where the fields are added to $result[‘columnsToProcess’]
    - TcaColumnsRemoveUnused: where the fields NOT in ‘columnsToProcess’ are removed from $result[‘processedTca’][‘columns’]

    The problem here is that there is not a clear distinction between columnsToProcess and the columns to show.

    I am hoping there might be a possibility to provide this functionality for extension authors (also for other use cases) in order to slightly modify the core or provide a method which I have overlooked.

  2. Sybille Peters commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2026-09-23T13:20:12+00:00" > 09/23/26, 13:20 </span>

    Applied in changeset commit:19a5775249602cb4767100d91aebbacfa9f2a566.