<?php
/** @var \Zend\Form\Form $form */
$form = $this->formWidget;
$form->prepare();
$form->setAttribute('method', 'post');
$form->setAttribute('class', 'form-horizontal');
?>

<?= $this->form()->openTag($form) ?>
<?php foreach ($form as $element): ?>
	<?php
	/** @var \Zend\Form\Element $element */
	if($element->getAttribute('type') == 'hidden'): ?>
		<?= $this->formInput($element) . $this->pserverformerrors($element) ?>
	<?php
	 	continue;
	 endif;
	?>
    <div class="form-group">
        <?php if ($element instanceof Zend\Form\Element\Button): ?>
            <div class="col-sm-12">
                <?= $this->formButton($element) ?>
            </div>
		<?php elseif ($element instanceof Zend\Form\Element\Captcha): ?>
			<div class="col-sm-12">
				<?= $this->formCaptcha($element) . $this->pserverformerrors($element) ?>
			</div>
		<?php elseif ($element instanceof PServerCore\Form\Element\DateTimeJQuery): ?>
			<div class="col-sm-12">
				<?= $this->formInput($element) . $this->pserverformerrors($element) ?>
			</div>
		<?php elseif ($element instanceof Zend\Form\Element\DateTimeLocal): ?>
			<div class="col-sm-12">
				<?= $this->formDateTimeLocal($element) . $this->pserverformerrors($element) ?>
			</div>
		<?php elseif ($element instanceof Zend\Form\Element\DateTime): ?>
			<div class="col-sm-12">
				<?= $this->formDateTime($element) . $this->pserverformerrors($element) ?>
			</div>
		<?php elseif ($element instanceof DoctrineModule\Form\Element\ObjectSelect || $element instanceof Zend\Form\Element\Select): ?>
			<div class="col-sm-12">
				<?= $this->formSelect($element) . $this->pserverformerrors($element) ?>
			</div>
		<?php elseif ($element instanceof Zend\Form\Element\Textarea): ?>
			<div class="col-sm-12">
				<?= $this->formTextarea($element) . $this->pserverformerrors($element) ?>
			</div>
		<?php elseif ($element instanceof Zend\Form\Element\Checkbox): ?>
			<div class="col-sm-12">
				<div class="checkbox">
					<label>
						<?= $this->formCheckbox($element) . $this->formLabel($element) . $this->pserverformerrors($element) ?>
					</label>
				</div>
			</div>
		<?php else: ?>
            <div class="col-sm-12">
                <?= $this->formInput($element) . $this->pserverformerrors($element) ?>
            </div>
        <?php endif ?>
    </div>
<?php endforeach ?>
<?= $this->form()->closeTag() ?>