Skip to content

Instantly share code, notes, and snippets.

@renepardon
Created January 20, 2013 22:03
Show Gist options
  • Save renepardon/4582099 to your computer and use it in GitHub Desktop.
Save renepardon/4582099 to your computer and use it in GitHub Desktop.
<?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