Skip to content
This repository has been archived by the owner on Jul 10, 2020. It is now read-only.

How to add a custom helper to TwbBundleFormElement? #137

Closed
Saeven opened this issue Apr 6, 2015 · 1 comment
Closed

How to add a custom helper to TwbBundleFormElement? #137

Saeven opened this issue Apr 6, 2015 · 1 comment

Comments

@Saeven
Copy link
Contributor

Saeven commented Apr 6, 2015

Hi there.

Great lib, thanks!

I have a need to add a simple div element to a form, and have added the right helpers and elements as required. How do I add a definition to TwbBundleFormElement in a future-proof manner?

I realize it extends FormElement which has addClass, but I'm not quite sure how to tap into it given the circumstances.

Thanks!

If I drop the line below into your class map, everything works.

    /**
     * Instance map to view helper
     *
     * @var array
     */
    protected $classMap = array(
        'Zend\Form\Element\Button' => 'formbutton',
        'Zend\Form\Element\Captcha' => 'formcaptcha',
        'Zend\Form\Element\Csrf' => 'formhidden',
        'Zend\Form\Element\Collection' => 'formcollection',
        'Zend\Form\Element\DateTimeSelect' => 'formdatetimeselect',
        'Zend\Form\Element\DateSelect' => 'formdateselect',
        'Zend\Form\Element\MonthSelect' => 'formmonthselect',
        'TwbBundle\Form\Element\StaticElement' => 'formStatic',
    'Application\Form\Element\DivElement' => 'formDiv',   // add this
    );
@Saeven
Copy link
Contributor Author

Saeven commented Apr 6, 2015

Realize this discussion already exists here #50

@Saeven Saeven closed this as completed Apr 6, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant