ZF-3518: CLONE -Adding brute text - the old one was resolved

Description

We should be able to add a gross text and use it like label. Exemple for checkbox I accept this condition

Comments

API could be something like


$select = new Zend_Form_Select() //create some element
$plain = new Zend_Form_Element_PlainText('myPlainText'); //plain text node element
$plain->setText('
This item needs further explanation, which can be found here
'); //set text for the node $form->addElement($select); $form->addElement($plain);

Result:




...
This item needs further explanation, which can be found here

Sorry if cloning was not needed, but the old issue was closed with result, so it seems no one won't check for new comments there anymore.

I'm not sure that this is needed. the usecase described is easily resolved by simply using setDescription on the element you want to add some text for. If you then wish to alter how the description is displayed, you can simply change the properties / order of the decorators on the element.

Is there any other usecase than adding some meta to an existing element in a form, or to the form itself?

Yes, in some cases. Let's think of elements like "blocks" that build the form. Description is "more information about element". When you need, let's say, add description to the checkbox "Without agreement you can't place the order". And than you need to "echo" the license agreement. You can'T set two different descriptions, can you? Imagine client of my eshop wants sometimes the LA above and sometimes below the checkbox. To change this i have to juggle the element's decorators (for example when using table form) to have the LA in single row. And no the same row as element. Whereas with new "form element" it would be only as easy as changing element positions. Or other - let's have this form structure:

How would I set the "long_text"? Plaintext element would offer painless solution for all the problems. I should have "ignore" always to "true" and "require" to "false" and would be compatible with current form implementation. In addition it would benefit from the abbility to be decorated using decorators.

Not mentioning that the copied issue has the same resolution: "Create your own element." @see http://nabble.com/Include-raw-HTML-into-Zend_Form-…