From 3daa49eea72c71db6442e6fd9939d5a18a3fb55a Mon Sep 17 00:00:00 2001 From: Serge Kraev Date: Thu, 16 Feb 2017 18:14:59 +0400 Subject: [PATCH 1/2] add the ability to specify multiple column sizes It adds the ability to specify multiple column sizes for different size screens. By example: $element->setOption('column-size', array('lg-3', 'md-6')); --- src/TwbBundle/Form/View/Helper/TwbBundleFormRow.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/TwbBundle/Form/View/Helper/TwbBundleFormRow.php b/src/TwbBundle/Form/View/Helper/TwbBundleFormRow.php index ebd1c66..eac909b 100644 --- a/src/TwbBundle/Form/View/Helper/TwbBundleFormRow.php +++ b/src/TwbBundle/Form/View/Helper/TwbBundleFormRow.php @@ -129,7 +129,8 @@ public function getRowClassFromElement(\Zend\Form\ElementInterface $oElement) // Column size if (($sColumSize = $oElement->getOption('column-size')) && $oElement->getOption('twb-layout') !== TwbBundleForm::LAYOUT_HORIZONTAL ) { - $sRowClass .= ' col-' . $sColumSize; + $sColumSize = (is_array($sColumSize)) ? $sColumSize : array($sColumSize); + $sRowClass .= implode(' ', array_map(function($item) { return 'col-' . $item; }, $sColumSize)); } //Additional row class From 61ad8441f82e24226f97ba592732593b26054d58 Mon Sep 17 00:00:00 2001 From: Serge Kraev Date: Thu, 16 Feb 2017 19:10:35 +0400 Subject: [PATCH 2/2] fix spaces for row class --- src/TwbBundle/Form/View/Helper/TwbBundleFormRow.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/TwbBundle/Form/View/Helper/TwbBundleFormRow.php b/src/TwbBundle/Form/View/Helper/TwbBundleFormRow.php index eac909b..a7d1772 100644 --- a/src/TwbBundle/Form/View/Helper/TwbBundleFormRow.php +++ b/src/TwbBundle/Form/View/Helper/TwbBundleFormRow.php @@ -130,7 +130,7 @@ public function getRowClassFromElement(\Zend\Form\ElementInterface $oElement) if (($sColumSize = $oElement->getOption('column-size')) && $oElement->getOption('twb-layout') !== TwbBundleForm::LAYOUT_HORIZONTAL ) { $sColumSize = (is_array($sColumSize)) ? $sColumSize : array($sColumSize); - $sRowClass .= implode(' ', array_map(function($item) { return 'col-' . $item; }, $sColumSize)); + $sRowClass .= implode('', array_map(function($item) { return ' col-' . $item; }, $sColumSize)); } //Additional row class