[TYPO3-core] RFC: fix bug #1801 (no real read-only TCA field)

René Fritz rene at typo3.org
Mon Jan 23 15:39:09 CET 2006


Update, see below

> This is a CVS patch request.
>
> Problem: TCA doesn't support read-only fields out-of-the-box except plain
> text fields. If you need custom types, even simple ones, you must use a
> custom fucntion with type "user".
>
> Solution: Enhance type "none" with a set of useful types and formatting
> options.
>
> Description: This patch adds the config option "format". It takes
> precedence before "rows". "format" takes a comma delited string witn
> formating options: <type>,<option>. The syntax of option depends on the
> type. Some of the types are there to have a compatible syntax to "eval" of
> type "input".
>
> date[,<date() format string] = timestamp with default d-m-Y
> datetime = timestamp with i:H d-m-Y
> dateage = timestamp with d-m-Y and a trailing age in brackets
> year = timestamp, only year shown
> time[,<strftime() format string] = timestamp with default %M:%H
> timesec = timestamp with default %M:%H:%S
> int[,dec|hex|oct|bin] = integer field, decimal output is default
> float[,precision] = floating point field, default precision of 2
> md5 = md5 hash (hide values, but make content comparable]
> user[,<function>[,args]] = a user function

added:
filesize = render integer as: "25 kb (24123)"

>
> As an alternative we could use format.option and the occasional extra
> argument for some types.
>
> So we could have, eg:
>
> format = date
> format.option = d-m-y
> format.age = 1
>
> format = user
> format.option = <userfunc>
> format.args = blah

In general this might be more nice but I have no time to think much about it 
and using comma list is more TYPO3 style even if it's ugly. So I leave it as 
it is.

> The user function type is not really necessary as you can use type "user".
> But IMHO it's a bit cleaner as type "user" implies a field with input
> capabilities, while type "none" and subtype "user" makes it clear that it
> is a read-only field.
>
> Any comments? I think that the types and the configuration (string vs
> attribute) need some discussion.
>
> Masi
>
> PS: I have also removed the dead-code that had a default of 5 rows.
>
> PPS: The Core API doc has an errors. The description of type has "[Must be
> set to "" (blank string!)]", but should read "[Must be set to "none"]".

Changes to the original patch:
- I put the code into an extra formatting function 
- use the default <div> from getSingleField_typeNone_render() instead 
introducing a new one.

Todo:
- Update of the docu is needed.

Nice to have:
- Rendering of select and group field data as text lists including feching 
titles for items etc


René

-- 
René Fritz
TYPO3 Association - Active Member
http://association.typo3.org/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: t3lib_tceforms-enhanceTypeNone-02.diff
Type: text/x-diff
Size: 4206 bytes
Desc: not available
Url : http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20060123/79904cc0/attachment.bin 


More information about the TYPO3-team-core mailing list