"Display this field" doesn't persist
kswan - November 26, 2008 - 16:03
| Project: | Computed Field |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
Changing the setting of Display this field doesn't appear to persist. The field is always displayed.
From line 35 of computed_field.module:
$form['display'] = array(
'#type' => 'checkbox',
'#title' => t('Display this field'),
'#default_value' => is_numeric($field['code']) ? $field['code'] : TRUE ,
);Changing the default value to:
'#default_value' => is_numeric($field['display']) ? $field['display'] : TRUE shows that actually the setting is persisting, but the field is still displayed regardless of the setting.
I couldn't find any reason that the setting wouldn't disable the field display.

#1
Have u got a fix for this? Im having the same issue
#2
A simple work-around is to put the following code in "Display Format"
$display = '';I haven't dug into the module code enough to find the problem. The work-around was sufficiently effective for me.
#3
Could u tell me in what line of code to put this?
thnx in advance!
#4
Click on "Administer" -> "Content Types" -> select the content type that contains your computed field -> click on "Configure" beside the computed field. Then scroll down to the "Display Format:" text box (right below "Display this field"). Then you can paste
$display = '';in the "Display Format:" text box.Now this field will not show on a node view, but will be available for filtering and sorting in Views.
#5
Hehe, to easy
But, if i use the code, the value of the field wont display in my Views
#6
The corrections at the code and the trick work, will the authors fix the issue?
#7
Hmm... we'll there is certainly a bug in that code. :)
But really my question is do we need the display option at all? The field can already be hidden from display, like any other CCK field, via CCK's "Display fields" options. So really, at best, this would be a redundant feature, that may save a couple clicks, but doesn't even have the level of control that CCK's options have already.
Any thoughts?
I guess unless I'm missing some use case, I'll probably just remove the option and let people use CCK's display options.
#8
Moonshine,
Please note that the original issue refers to two bugs. The first one is the issue of the setting showing correctly on the field settings page (can be resolved by correcting the default_value entry). The other bug I didn't resolve was that the setting didn't affect the display on a node view.
Some possible use cases for the Display format are a Calculated field containing currency or date. In these cases you would want the database to store a float or unix timestamp, but display formatted currency or date.
#9
Howdy..
Yes, no doubt there is a bug in the current display default handling in Computed Field and its use for controlling display on node view. However, what I'm saying is that this on/off display setting looks like redundant option to me, as CCK already provides control for the display of any cck field (computed fields included) via it's "Display fields" settings. So it seems there would be two places controlling the visibility of the field, which isn't good. This option just came over from the the D5 version of Computed Field, so I never really thought about it much.
For example if you were doing something w/ a computed currency, you may choose a float Computed Field to store the value and then just use custom php display code to display it as you wish currently (ie adding commas/periods, currency symbols, etc) Now if you didn't want any display at all, you would just disable output in cck's "display fields" settings. CCK actually provides even more flexibility as it allows you to disable display per display mode.
Does that make sense, or am I not understanding the example properly?
Thanks!
#10
Yes you are right. I forgot about the Display Fields tab on my Content type. I agree it is much better to let CCK handle this than have your own "Display this field" setting.
I should have recommended using the Display Fields tab instead of hacking the Display Format.
Thank you.
#11
As Moonshine noted the checkbox came from D5 but due to different behavior of cck in d6 it wasn't working. The feature is redundant with the "Display fields" feature of cck, so there is no need for it anymore.
Killed!
#12
Automatically closed -- issue fixed for 2 weeks with no activity.