library/ZF2ValidatorBuilder/ValidatorBuilder.php
public function setElementRequired(\Zend\Form\Element $element) {
        $element->setAttribute('required', 'true'); //set browser validation
        $this->form->getInputFilter()->get($element->getAttribute('name'))->setAllowEmpty(false); //set backend requirement
    }
public function setElementRequired(\Zend\Form\Element $element) {
        $element->setAttribute('required', 'true'); //set browser validation
        $this->form->getInputFilter()->get($element->getAttribute('name'))->setAllowEmpty(false); //set backend requirement
    }
Set element required
frontend & backend validation
@param \Zend\Form\Element $element