title: Zend Framework 2 - Form Element Decorators
body: <p>I want to force the Zend form into Twitter Bootstrap style. I currently iterate through the form fields and write the form info into my bootstrap div construction.</p>
  
  <p>I saw in Zend Framework 1(!) that there is a way to do this within a decorator. But for some reason the doc for version 2 doesn't cover this point... </p>
  
  <p>I'd like to do something like this:</p>
  
  <pre><code>protected $_format = '&lt;label for="%s"&gt;%s&lt;/label&gt;'
               . '&lt;input id="%s" name="%s" type="text" value="%s"/&gt;';
  
  public function render($content)
  {
      $element = $this-&gt;getElement();
      $name    = htmlentities($element-&gt;getFullyQualifiedName());
      $label   = htmlentities($element-&gt;getLabel());
      $id      = htmlentities($element-&gt;getId());
      $value   = htmlentities($element-&gt;getValue());
  
      $markup  = sprintf($this-&gt;_format, $name, $label, $id, $name, $value);
      return $markup;
  }
  </code></pre>
  
  <p>Any ideas?</p>