Feature #19832
open
sectionMarker (page anchor) prefix is hardcoded as "c"
Added by Michiel Roos almost 16 years ago.
Updated over 4 years ago.
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)
Files
Good one! You could provide a patch if you'd like to... ;-)
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.
- Category deleted (
Communication)
- Target version deleted (
4.6.0-beta1)
- Category set to Frontend
- Status changed from New to Accepted
- PHP Version changed from 4.3 to 5.2
- Complexity set to hard
- Status changed from Accepted to Needs Feedback
- Is Regression set to No
Hi Michiel,
what's the state of this issue?
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
- Tracker changed from Bug to Feature
- Status changed from Needs Feedback to Accepted
- PHP Version deleted (
5.2)
- Sprint Focus set to On Location Sprint
- Status changed from Accepted to Under Review
I made a patch, though I'm not sure this should even be solved. It's an edge case.
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
- Status changed from Under Review to Accepted
- Sprint Focus deleted (
On Location Sprint)
Searched for "'#c'" string on latest master(10.4.0-dev) and found it in these files:
/typo3/sysext/backend/Classes/ContextMenu/ItemProviders/RecordProvider.php
/typo3/sysext/backend/Classes/Controller/EditDocumentController.php
/typo3/sysext/linkvalidator/Classes/LinkAnalyzer.php
/typo3/sysext/linkvalidator/Classes/Linktype/InternalLinktype.php
/typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php
Also available in: Atom
PDF