Created
January 20, 2013 22:03
-
-
Save renepardon/4582099 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Admin\Form\Blog; | |
use Zend\Form\Form; | |
use Zend\Stdlib\Hydrator\ObjectProperty; | |
class Article extends Form | |
{ | |
public function __construct($entityManager, $name = 'blog-article') | |
{ | |
parent::__construct($name); | |
$this->setHydrator(new ObjectProperty()); | |
$articleFieldset = new ArticleFieldset($entityManager); | |
$articleFieldset->setOptions(array('use_as_base_fieldset' => true)); | |
$this->add($articleFieldset); | |
$this->add( | |
array( | |
'type' => 'Zend\Form\Element\Csrf', | |
'name' => 'csrf', | |
) | |
); | |
$this->add( | |
array( | |
'type' => 'Zend\Form\Element\Submit', | |
'name' => 'submit', | |
'attributes' => array( | |
'value' => 'Create', | |
'class' => 'btn btn-primary', | |
), | |
) | |
); | |
$this->setValidationGroup( | |
array( | |
'csrf', | |
'article' => array( | |
'date', | |
'content', | |
'title', | |
'category', | |
'state', | |
) | |
) | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment