Last active
August 29, 2015 14:05
-
-
Save grizzm0/5a2dfe91f37a20c1f68a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Module\View\Helper; | |
use Module\Form\FooForm; | |
use Zend\View\Helper\AbstractHelper; | |
use Zend\View\Model\ViewModel; | |
class FooFormHelper extends AbstractHelper | |
{ | |
protected $fooForm; | |
protected $viewTemplate = 'module/layout/foo-form'; | |
public function __construct(FooForm $fooForm) | |
{ | |
$this->fooForm = $fooForm; | |
} | |
public function __invoke() | |
{ | |
$vm = new ViewModel([ | |
'form' => $this->fooForm; | |
]); | |
$vm->setTemplate($this->viewTemplate); | |
return $this->getView()->render($vm); | |
} | |
public function setViewTemplate($viewTemplate) | |
{ | |
$this->viewTemplate = $viewTemplate; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sweet stuff 👍