I've followed some answers on here and from what I can find on Google but I'm unable to override the renderOptions and setLabelPosition function in the FormMultiCheckbox helper.
I've created a new FormMultiCheckbox.php and saved it in my Application/Form/View/Helper folder and in this file I've redefined the renderOptions and setLabelPostion functions.
Then in Modue.php I've added the following line to the getViewHelperConfig function:
'invokables' => array(
'formmulticheckbox' => 'Application\Form\View\Helper\FormMultiCheckbox'
),
And in my view I'm adding the input to the screen with the following line:
echo $this->formRadio($about_you_form->get('user_gender'), 'block')
Where block is the new layout for the element I've created.
I'm basically trying to get the element to output the input first and then the label instead of putting everything inside the label tags.
I've tried both answers on this post (How to use a custom form view helper in Zend Framework 2?) but I'm getting the error message:
Zend\Form\View\Helper\FormMultiCheckbox::setLabelPosition expects either Zend\Form\View\Helper\FormMultiCheckbox::LABEL_APPEND or Zend\Form\View\Helper\FormMultiCheckbox::LABEL_PREPEND; received "block"
Which would suggest to me that it is not picking up my new renderOptions or setLabelPosition as the error message has been changed in the latter.
Any help or pointers much appreciated.
Regards,
Sean