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

Ingmar Schlecht ingmar at typo3.org
Wed Dec 6 23:09:57 CET 2006


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
	

-------------- next part --------------
A non-text attachment was scrubbed...
Name: record_title.patch
Type: text/x-diff
Size: 24450 bytes
Desc: not available
Url : http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20061206/97e2e9f6/attachment-0001.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: T3X_test_labels-0_0_0-z-200612062303.t3x
Type: application/octet-stream
Size: 17400 bytes
Desc: not available
Url : http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20061206/97e2e9f6/attachment-0001.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: record_title_doc.sxw
Type: application/vnd.sun.xml.writer
Size: 13669 bytes
Desc: not available
Url : http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20061206/97e2e9f6/attachment-0001.sxw 


More information about the TYPO3-team-core mailing list