[TYPO3-core] RFC: Better getRecordTitle() function introducing label_userFunc

Ingmar Schlecht ingmar at typo3.org
Mon Sep 3 12:04:22 CEST 2007


Hi Peter,

Olly has added that to the pending documentation page already, so it'll
be added by Stucki once he's updating the docs next time.

See: http://wiki.typo3.org/index.php/Pending_Documentation

@Olly, thanks for doing it!

cheers
Ingmar

Peter Niederlag schrieb:
> Hello,
> 
> This patch was submitted in December 2006.
> 
> It seems however that the needed modification of DOC:typo3_core_api
> didn't make it yet.  ;(
> 
> Ingmar sent it in Mail on this list on Wed, 06 Dec 2006 23:09:57 +0100.
> 
> I'd apply it right away but since I am not sure on the procedure of
> handling documentation-updates here's my mail.
> 
> Greets,
> Peter
> 
> Ingmar Schlecht schrieb:
>> This is a SVN patch request.
>>
>> Branch: trunk
>>
>> David Brühlmeier has written the patch and I've tested it.
>>
>> Forwarded mail from David Brühlmeier <typo3 at bruehlmeier.com>:
>> ----------------------------------------------------------------------
>>
>> Issue
>> -----
>> Getting the title of a record is not consistently implemented in the
>> core. In most places, the title is built properly using
>> t3lib_BEfunc::getRecordTitle(), but there are some functions which do
>> not adhere to this rule. Therefore, the additional TCA properties like
>> ['ctrl']['label_alt'] cannot be relied upon and it is not possible to
>> implement a hook to add custom logic to build record titles.
>>
>> Furthermore, I noted that the implementation of the no_label logic was
>> also spread in several places.
>>
>> Solution
>> --------
>> 1. All (hopefully... :-) places in the core where a record title is
>> needed are now using t3lib_BEfunc::getRecordTitle()
>> 2. t3lib_BEfunc::getRecordTitle() was expanded (backwards compatible) by
>> an additional (optional) parameter. If this parameter is set, the
>> function will _always_ return a value. If no value is found for the
>> title, '[No title]' is returned (localized).
>> 3. The new TCA option ['ctrl']['label_userFunc'] was introduced in
>> t3lib_BEfunc::getRecordTitle() to enable custom logic if needed.
>>
>>
>> Core Changes
>> ------------
>>
>> t3lib/class.t3lib_befunc.php
>>   - An optional parameter $forceResult was added to getRecordTitle().
>>     If this parameter is set, the function will _always_ return a value.
>>     If no value is found for the title, '[No title]' is returned
>>     (localized).
>>   - The new TCA option ['ctrl']['label_userFunc'] was introduced in
>>     getRecordTitle() to enable custom logic if needed. If set, it
>>     overrides all other ['ctrl']['label*'] settings.
>>
>> t3lib/class.t3lib_tceforms.php:
>>   - foreignTable() now delivers a [No title] (localized) if the record
>>     title could not be determined
>>   - The class-parameter $titleLen is no longer needed and deprecated.
>>   - The function noTitle() is no longer needed and declared deprecated
>>
>> typo3/class.browse_links.php
>>   - linkWrapItems() now delivers a [No title] (localized) if the record
>>     title could not be determined
>>
>> typo3/class.db_list_extra.inc
>>   - renderListRow() now consistently uses t3lib_BEfunc::getRecordTitle()
>>     to build the record title. Removed redundant code.
>>
>> typo3/class.show_rechis.inc
>>   - generateTitle() now uses t3lib_BEfunc::getRecordTitle() to build the
>>     record title.
>>
>> Documentation Changes
>> ---------------------
>> See attached sxw file for doc changes.
>>
>> doc_core_api
>>   * Added new property ['label_userFunc'] in the $TCA ['ctrl'] section
>>   * Updated the ['label'], ['label_alt'] and ['label_alt_force']
>>     properties in the $TCA ['ctrl'] section
>>
>> doc_core_cgl
>>   * TYPO3 specific practices: Added rule to always use
>>     t3lib_BEfunc::getRecordTitle() to build a title
>>
>> ----------------------------------------------------------------------
>>
>> cheers
>> Ingmar
>> 	
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> TYPO3-team-core mailing list
>> TYPO3-team-core at lists.netfielders.de
>> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-team-core
> 
> 


-- 
Ingmar Schlecht
TYPO3 Association Active Member


More information about the TYPO3-team-core mailing list