public function open()
{
if ($this->getErrors()) {
$this->state($this->app['former.framework']->errorState());
}
// Retrieve state and append it to classes
if ($this->state) {
$this->addClass($this->state);
}
// Required state
if ($this->app->bound('former.field') and $this->app['former.field']->isRequired()) {
$this->addClass($this->app['former']->getOption('required_class'));
}
return parent::open();
}