[Solar-talk] Another form question
Paul M Jones
pmjones at ciaweb.net
Wed Nov 21 09:51:10 CST 2007
On Nov 21, 2007, at 9:40 AM, Oscar wrote:
> Rodrigo Moraes wrote:
>> On Nov 21, 2007 1:56 AM, Oscar wrote:
>>> Elements can have a 'descr' attribute which is "A longer
>>> description of
>>> the element, such as a tooltip or help text."
>>>
>>> Is this attribute displayed when the form is rendered?
>> Actually, no. 'descr' is just a placeholder for a future feature. I
>> hacked Solar_View_Helper_Form to include a description right after
>> the
>> form field. Around line 593:
>> // add the form element
>> $form[] = " <dt$require><label$require
>> for=\"$id\">$label</label></dt>";
>> $form[] = " <dd$require>$element";
>> // A haaack!
>> if (! empty($info['descr'])) {
>> $form[] = " <p>{$info['descr']}
>> </p>";
>> }
>> -- rodrigo
>> _______________________________________________
>> Solar-talk mailing list
>> Solar-talk at lists.solarphp.com
>> http://mailman-mail3.webfaction.com/listinfo/solar-talk
>
> Excellent - that's what it looked like to me, but I was a little
> more wary of hacking away :)
>
> One tweak, to make the descr more styleable:
>
> // A haaack!
> if (! empty($info['descr'])) {
> $form[] = " <div class=\"descr
> \">{$info['descr']}</div>";
> }
Sounds like it's time to make this "real". ;-) For
Solar_View_Helper_Form, then:
* Add a $_descr_tag property and config, default value 'div' (but you
can make it 'p'). This is the tag that goes around the description
XHTML.
* Add a $_descr_class property and config, default value 'descr' (for
the class so you can style it).
* Add a $_descr_elem property and config, default value 'dt' (to say
where the description should be rendered, as part of the 'dd' or as
part of the 'dt' element).
And then add the necessary rendering logic as you guys have done.
Does that sound sufficiently useful and flexible? (I don't want it
*too* flexible -- too many options can be a bad thing.)
--
Paul M. Jones <http://paul-m-jones.com>
Solar: Simple Object Library and Application Repository
for PHP5. <http://solarphp.com>
Join the Solar community wiki! <http://solarphp.org>
Savant: The simple, elegant, and powerful solution for
templates in PHP. <http://phpsavant.com>
More information about the Solar-talk
mailing list