[Product-Developers] how to hide widget's label?

SimO simahawk at gmail.com
Wed Jan 28 11:03:34 UTC 2009


Martin Aspeli wrote:
> 
> 
> Wichert Akkerman wrote:
>> Previously Nathan Van Gheem wrote:
>>>> However I wonder if is not useful to control every parameter of a
>>>> widget... I hope see this kind of feature in the next release of AT :)
>>>>
>>> Maybe a feature request for dexterity--the new and much improved content
>>> type api.  I doubt Archetypes will change much in the future; although,
>>> it
>>> would be very simple to introduce this functionality.
>> Or maybe this is a visual thing and should be done in CSS instead of in
>> a layer such as Archetypes or dexterity. AT and dexterity should just
>> output semantic markup and not concern themselves with visual aspects
>> like this.
>>
> 
> My vote would go for doing this in CSS. We should obviously support empty
> labels, but that should be output as empty <label /> tags or whatever, which
> you may still want to hide.
> 
> Martin

Maybe I'm too simplistic but what about a simple "property=True"?

    atapi.StringField(
	[...]
        widget=atapi.StringWidget(
            label=(True,_(u"myField")),
            description=(False,''),
        ),
    	[...]

If property[0]=True: show property[1], else: don't return any tag.


BTW I found this in the file skins/archetypes/widgets/field.pt:

[...]
    <metal:base_view_macro
        define-macro="base_view"
        tal:define="widget_view
python:here.widget(field.getName(), 								mode=mode, use_label=1);
[...]

Is this "use_label" an attempt to do it? I tried to set it to 0/None but
nothing happened.




More information about the Product-Developers mailing list