Skip to content

Instantly share code, notes, and snippets.

@typeoneerror
Created June 28, 2011 22:51
Show Gist options
  • Save typeoneerror/1052453 to your computer and use it in GitHub Desktop.
Save typeoneerror/1052453 to your computer and use it in GitHub Desktop.
decorator hell
/**
* Load the default decorators for forms.
*
* @return Typeoneerror_Form Reference to form instance
*/
public function loadDefaultDecorators()
{
// wipe all
$this->clearDecorators();
// just add form elements
$this->addDecorator("FormElements")
->addDecorator("Form");
// form and fieldsets for groups
$this->setDisplayGroupDecorators(array(
"FormElements",
array("HtmlTag", array(
"class" => "fieldset-wrapper",
"tag" => "div",
)),
"Fieldset",
));
return $this;
}
/**
* Adds default decorators to the form elements.
*
* @return Typeoneerror_Form
*/
public function loadDefaultElementDecorators()
{
$this->setElementDecorators(array(
"ViewHelper",
"Errors",
array("Label"),
array("HtmlTag", array(
"tag" => "div",
"class" =>"element",
)),
));
return $this;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment