Skip to content
This repository has been archived by the owner on Nov 11, 2022. It is now read-only.

Commit

Permalink
Some improvements on reset and dimensions (#2)
Browse files Browse the repository at this point in the history
* Prevent PHP (7) Error

Solve error with strict standards: Only variables should be passed by reference

* Remove dimensions if any

* Comply with Zend_View_Helper_FormReset

Twitter_Bootstrap3_View_Helper_FormReset must be setup in the same way Zend_View_Helper_FormReset is setup, otherwise this will cause exception.

* Add support for "class" attrib

If adding elements to a form, class is lost. This is especially true for selects and such elements, which do not have a special view helper.
Added manual assignment of class if class is given.
  • Loading branch information
Cruiser13 authored and wendrowycz committed Sep 6, 2016
1 parent 5ba6e23 commit d41827c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions library/Twitter/Bootstrap3/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,10 @@ public function addElement($element, $name = null, $options = null)
// Load default decorators
if ((null === $options) || !is_array($options)) {
$options = array();
//Class is maybe not properly transfered to this element. We'll add class if it exists here.
if($element->class){
$options['class'] = $element->class;
}
}

if (!array_key_exists('decorators', $options)) {
Expand Down
2 changes: 1 addition & 1 deletion library/Twitter/Bootstrap3/View/Helper/FormReset.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Twitter_Bootstrap3_View_Helper_FormReset extends Zend_View_Helper_FormRese
*
* @return string The element XHTML.
*/
public function formReset($name, $value = null, $attribs = null)
public function formReset($name = '', $value = 'Reset', $attribs = NULL)
{
if (isset($attribs['class'])) {
$attribs['class'] = 'btn ' . $attribs['class'];
Expand Down

0 comments on commit d41827c

Please sign in to comment.