|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
Custom labels in DDI'd like to make a small change to the BL2 compiler that would change
the way the xar:data-label tag works. Example: <xar:data-label property="$properties[$name]" label="id" /> Unless I'm mistaken this should be <xar:data-label property="$properties[$name]" for="id" /> The desired effect is for the attribute value "id" (other values are possible) to add a "for" attribute to the html label tag created, identifying the label as belonging to the property with id corresponding to that of the property $properties[$name]. I've wondered about the use of the "label" attribute rather than the "for" attribute in the tag in the past, and mainly had taken my cue from the use of label="id" in a couple of places in DD module (the only place in the core modules it is used I believe), and in particular by the comments in the label tag's (1x) handler file: * <xar:data-label property="$property" label="id" /> will use <label for="dd_$property->id">...</label> * <xar:data-label property="$property" label="name" /> will use <label for="$property->name">...</label> * <xar:data-label property="$property" label="something" /> will use <label for="something">...</label> But on closer examination this does not make sense to me. If the handler immediately changes a "label" attribute into a "for" array element before passing it to the showLabel method, why bother with "label" at all? More to the point, the way this is handled means there is in effect no way to pass a "real" alternative label value to the showLabel method for display in its template. And yet there appears to be code in the showLabel method that expects this: extract($data) ..... $data['label'] = isset($label) ? xarVarPrepForDisplay($label) : xarVarPrepForDisplay($this->label); I'm pretty sure requiring using the "label" attribute in the tag in this way is an error, as it makes it impossible to override a dataproperty's initial display label in a template, which seems a reasonable thing to require. Any objection to changing this? As mentioned among core modules only DD has this in a couple of places. For modules the change would require changing label="id" to for="id" wherever it appears. Marc _______________________________________________ Xaraya_devel mailing list Xaraya_devel@... http://xaraya.com/mailman/listinfo/xaraya_devel |
|
|
Re: Custom labels in DDApart from the fact that i think xar:data-* tags should be reviewed in
general and that the xar:data-label in particular should disappear alltogether, no objections :D marcel On 4 jul 2008, at 13:48, marcinmilan@... wrote: > I'd like to make a small change to the BL2 compiler that would change > the way the xar:data-label tag works. Example: > > <xar:data-label property="$properties[$name]" label="id" /> > > Unless I'm mistaken this should be > > <xar:data-label property="$properties[$name]" for="id" /> > > > The desired effect is for the attribute value "id" (other values are > possible) to add a "for" attribute to the html label tag created, > identifying the label as belonging to the property with id > corresponding > to that of the property $properties[$name]. > > I've wondered about the use of the "label" attribute rather than the > "for" attribute in the tag in the past, and mainly had taken my cue > from > the use of label="id" in a couple of places in DD module (the only > place > in the core modules it is used I believe), and in particular by the > comments in the label tag's (1x) handler file: > > * <xar:data-label property="$property" label="id" /> will use > <label for="dd_$property->id">...</label> > * <xar:data-label property="$property" label="name" /> will use > <label for="$property->name">...</label> > * <xar:data-label property="$property" label="something" /> > will > use <label for="something">...</label> When label="somevalue": 1. if "somevalue" is the name of $property, use its value in the 'for' attribute 2. if not, use the verbatim string. Which, if correct, makes sense to me. That correct? > But on closer examination this does not make sense to me. If the > handler > immediately changes a "label" attribute into a "for" array element > before passing it to the showLabel method, why bother with "label" > at all? Because in other xml dialects than html (say xforms) it might be something else. This abstraction, as such, makes sense in theory. Seeing that we spit html most of the time, we might as well call it 'for' > More to the point, the way this is handled means there is in effect no > way to pass a "real" alternative label value to the showLabel method > for > display in its template. And yet there appears to be code in the > showLabel method that expects this: > > extract($data) > ..... > $data['label'] = isset($label) ? xarVarPrepForDisplay($label) : > xarVarPrepForDisplay($this->label); > > I'm pretty sure requiring using the "label" attribute in the tag in > this > way is an error, as it makes it impossible to override a > dataproperty's > initial display label in a template, which seems a reasonable thing to > require. > > Any objection to changing this? marcel -- Marcel van der Boom -- http://hsdev.com/mvdb.vcf HS-Development BV -- http://www.hsdev.com So! web applications -- http://make-it-so.info Cobra Replica build -- http://cobra.mrblog.nl _______________________________________________ Xaraya_devel mailing list Xaraya_devel@... http://xaraya.com/mailman/listinfo/xaraya_devel |
| Free Forum Powered by Nabble | Forum Help |