Feature #19832

sectionMarker (page anchor) prefix is hardcoded as "c"

Added by Michiel Roos over 10 years ago. Updated 5 months ago.

Status:
Accepted
Priority:
Should have
Assignee:
-
Category:
Frontend
Target version:
-
Start date:
2009-01-15
Due date:
% Done:

0%

PHP Version:
Tags:
Complexity:
hard
Sprint Focus:
On Location Sprint

Description

sectionMarker (page anchor) prefix is hardcoded as "c" while it is freely configurable in css styled content.

You can change the page anchor from the default:
tt_content.stdWrap.dataWrap = <a id="c{field:uid}"></a> |

To something like:
tt_content.stdWrap.innerWrap.cObject.default.10.value = <div id="section-{field:uid}">|</div>

Or
tt_content.stdWrap.innerWrap.cObject.default.10.value = <div id="content-element-{field:uid}">|</div>

Although it is longer, it's more descriptive.

The point is that is is changeable by the user. But the anchor prefix is hardcoded in the core as being "c".

This is in the following files:
sysext/cms/tslib/class.tslib_content.php (line 5268 and line 5390)
sysext/simulatestatic/class.tx_simulatestatic.php (line 166)

(issue imported from #M10147)

bug-10147.diff View (2.9 KB) Administrator Admin, 2011-03-17 16:25


Related issues

Related to TYPO3 Core - Feature #73621: Make anchors editable Closed 2016-02-23

History

#1 Updated by Oliver Hader over 10 years ago

Good one! You could provide a patch if you'd like to... ;-)

#2 Updated by Michiel Roos over 8 years ago

Ugly patch attached.

It looks like some more magic is needed since the user may specify other tt_content fields too:

<div id="content-element-{field:uid}-{field:crdate}-blah">

But it fixes the simplest case where only uid is used.

#3 Updated by Xavier Perseguers almost 8 years ago

  • Category deleted (Communication)
  • Target version deleted (4.6.0-beta1)

#4 Updated by Thorsten Kahler almost 8 years ago

  • Category set to Frontend
  • Status changed from New to Accepted
  • PHP Version changed from 4.3 to 5.2
  • Complexity set to hard

#5 Updated by Alexander Opitz almost 5 years ago

  • Status changed from Accepted to Needs Feedback
  • Is Regression set to No

Hi Michiel,

what's the state of this issue?

#6 Updated by Riccardo De Contardi over 4 years ago

Still present in 6.2 I guess:

/typo3/sysext/core/Classes/TypoScript/TemplateService.php, line 1529:

$LD['sectionIndex'] = $page['sectionIndex_uid'] ? '#c' . $page['sectionIndex_uid'] : '';

/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php,
line 5740:
$sectionMark = $sectionMark ? (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($sectionMark) ? '#c' : '#') . $sectionMark : '';

line 5946:
$sectionMark = (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($sectionMark) ? '#c' : '#') . $sectionMark;

The string " '#c' " is also present in:
/typo3/sysext/linkvalidator/Classes/LinkAnalyzer.php
/typo3/sysext/linkvalidator/Classes/LinkType/InternalLinktype.php

#7 Updated by Frans Saris about 4 years ago

  • Tracker changed from Bug to Feature
  • Status changed from Needs Feedback to Accepted
  • PHP Version deleted (5.2)

#8 Updated by Susanne Moog about 1 year ago

  • Sprint Focus set to On Location Sprint

#9 Updated by Gerrit Code Review about 1 year ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/57321

#10 Updated by Patrick Schriner about 1 year ago

I made a patch, though I'm not sure this should even be solved. It's an edge case.

#11 Updated by Gerrit Code Review 12 months ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/57321

#12 Updated by Joerg Kummer 12 months ago

To test this behaviour following typoscript setup will help.
Use this setup as root typoscript template on any page with some content elements of any kind (header needed).

/**
* TypoScript setup to test issue #18932
*/

// New config variable 'sectionLinkPrefix' - you need to adapt content wraps
// (typo3/sysext/fluid_styled_content/Resources/Private/Layouts/Default.html)
config.sectionLinkPrefix = section-element

// Default menu - with section index enabled
// (https://docs.typo3.org/typo3cms/TyposcriptReference/MenuObjects/Sectionindex/Index.html)
lib.defaultMenu = HMENU
lib.defaultMenu {
    entryLevel = 0
    1 = TMENU
    1.NO = 1
    1.NO.allWrap = <li>|</li>
    1.wrap = <ul>|</ul>
    1.sectionIndex = 1
    1.sectionIndex.type = all
    2 = TMENU
    2.NO = 1
    2.NO.allWrap = <li>|</li>
    2.wrap = <ul>|</ul>
    2.sectionIndex = 1
    2.sectionIndex.type = all
    stdWrap.outerWrap = <h2>Default menu - HMNEU with section index enabled</h2>|<hr />
}

// Section Menu - typolink with section in a CONTENT obj rendering context (integer)
lib.sectionMenuInteger = CONTENT
lib.sectionMenuInteger {
    table = tt_content
    renderObj = TEXT
    renderObj {
        field = header
        typolink {
            parameter.data = TSFE:id
            section.field = uid
            wrap = <li>|</li>
        }
    }
    wrap = <ul>|</ul>
    stdWrap.outerWrap = <h2>Section Menu - typolink with section in a CONTENT obj rendering context, where section field is integer (uid)</h2>|<hr />
}

// Section Menu - typolink with section in a CONTENT obj rendering context (string)
lib.sectionMenuString = CONTENT
lib.sectionMenuString {
    table = tt_content
    renderObj = TEXT
    renderObj {
        field = header
        typolink {
            parameter.data = TSFE:id
            section.field = header
            wrap = <li>|</li>
        }
    }
    wrap = <ul>|</ul>
    stdWrap.outerWrap = <h2>Section Menu - typolink with section in a CONTENT obj rendering context, where section field is string (header)</h2>|<hr />
}

// Section link - simple typolink with section
lib.sectionLink = TEXT
lib.sectionLink {
    value = Link to this page
    typolink {
        parameter.data = TSFE:id
        section.field = uid
    }
    wrap = <h2>Section link - simple typolink with section</h2>|<hr />
}

// Page object - collects all examples above
page = PAGE
// Default menu
page.10 < lib.defaultMenu
// Section menu
page.20 < lib.sectionMenuInteger
page.30 < lib.sectionMenuString
// Section link
page.40 < lib.sectionLink
// Content
page.100 < styles.content.get

#13 Updated by Susanne Moog 5 months ago

  • Status changed from Under Review to Accepted

Review was abandoned.

Also available in: Atom PDF