Reputation: 770
hey guys I have a problem adding text inside an added html-tag
I have this:
public $elementDecorators = array(
'ViewHelper',
'Errors',
array('HtmlTag', array('tag' => 'span', 'class' => 'checkbox','description' => 'Club')),
public function init() {
$this->setMethod('post');
//$this->setAttrib('action','index');
$this->addElement('checkbox', 'Club', array(
'decorators' => $this->elementDecorators,
));
//omitted code
which outputs:
<span class="checkbox" markup="Club" description="Club">
<input type="hidden" name="Club" value="0"><input type="checkbox" name="Club" id="Club" value="1"></span>
And what I need to do is have this:
<span class="checkbox" markup="Club" description="Club">This is club
<input type="hidden" name="Club" value="0"><input type="checkbox" name="Club" id="Club" value="1"></span>
I figure it shouldn't be that hard but I can't figure out an easy/good way to do it. Any suqqestions?
Upvotes: 1
Views: 937
Reputation: 377
Unfortunately You can't add content to HtmlTag decorator. You need to write Your own, or use callback decorator - check this answer https://stackoverflow.com/a/9812186/1278879
Upvotes: 4