Download the PHP package tavy315/twitter-bootstrap-zend-form-decorator without Composer
On this page you can find all versions of the php package tavy315/twitter-bootstrap-zend-form-decorator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tavy315/twitter-bootstrap-zend-form-decorator
More information about tavy315/twitter-bootstrap-zend-form-decorator
Files in tavy315/twitter-bootstrap-zend-form-decorator
Package twitter-bootstrap-zend-form-decorator
Short Description Zend_Form decorators for Twitter's Bootstrap UI
License MIT
Informations about the package twitter-bootstrap-zend-form-decorator
Zend_Form decorators for Twitter's Bootstrap
This is a set of Zend_Form decorators and helpers that help to render the markup needed to display any Zend_Form as a Twitter's Bootstrap form.
This is cool stuff, but how?
Here is an example form with some form fields
API Documentation
Forms
Vertical forms (default style)
Horizontal forms
Inline forms
Search form
Search forms can be rendered in a navigation bar or as a normal forms. Search forms are classes that cannot be extended. Instead it supports several option in order to configure the look and feel of the form.
-
renderInNavBar (boolean) Renders the form for displaying it in a navigation bar. In this mode no submit button will be rendered. (defaults to false)
-
pullItRight (boolean) This option only takes effect if the renderInNavBar option has been set to true, and its purpose is to align the search form at the right of the navigation bar. (defaults to false)
-
inputName (string) This option specifies a custom name for the search input. (defaults to searchQuery)
- submitLabel (string) If the submit button will be rendered the label can be customized by passing the submitLabel option. (defaults to Submit)
DisplayGroups
The base class (so inherently, all its subclasses) sets the custom class as a base class for handling virtual field groups. So there is no need for special coding here.
New form elements
In order to leverage the astonishing look and feel of Twitter Bootstrap buttons, a new special form element has been created in order to set all the appropiate class names.
Submit button
To configure the look and feel of a submit button there are several options supported
-
buttonType (string) This option specifies the button type that will be rendered. Twitter Bootstrap 3 supports seven button types out of the box
- default (obviously, the default button style)
- primary
- info
- success
- warning
- danger
- link
- disabled (boolean) If true, the submit button will be rendered as disabled.
Button
This form element is an extension of the submit button in order to provide a way to render HTML inside the button. So it's providing the same features as the submit button plus the hability to render a glyphicon as a button label. Let's see it.
-
icon (string) This option specify the icon used inside the button.
- whiteIcon (boolean) This option specify whether the icon should be rendered in white color. (default false)
Decorators
Actions decorator
The purpose of this decorator is to set the appropiate markup to render the form's submit buttons.
Addon decorator
This decorator allows specify some content that will be appended or prepended to the given input. It can render text, a glyphicon or a checkbox. To accomplish this it supports several options that will be set to the form element itself. If you pass an element that is a Zend_Form_Element_Submit element, it will put it there without the span.
-
prepend (string) Prepends the content of the option to the generated field form.
- append (string) Appends the content of the option to the generated field form.
The content of the both options could be a string containing some text, an array or an instance of the class or a glyphicon. When
-
'Text' specified, it will render as is.
- Zend_Config or array specified, it will generate a checkbox. Note that if the key "active" is passed inside the array or inside the Zend_Config instance, it will render the prepended or appended box with green background.
Fieldsize decorator
In order to specify a size of an input a special decorator is executed at the very begining of the decorator chain to set the appropiate class name. The size of an input can be set by the element's attribute size.
Installation
In order to use Bootstrap 3, the needed assets need to be installed in your assets directory. Make sure to install also the glyphicons properly. Once all this stuff has been installed, create/modify a layout view script and add a reference to the Bootstrap CSS.
So that's it. Now you can start creating forms and rendering them the way shown before and you will get nice forms!
Contributors
- adepretis [email protected]
- rafalgalka http://blog.modernweb.pl
- lrobert http://www.leerobert.ca
- marcelaraujo [email protected]
- mardagg666 https://github.com/Mardagg666