From 31edfa4b05ccb053c27a1c240ba38074975600de Mon Sep 17 00:00:00 2001 From: Mark Garrett Date: Mon, 17 Feb 2014 14:56:40 -0600 Subject: [PATCH 1/3] Move dismissible button to front - test update Update test --- tests/_files/expected-alerts/alerts-dismissable.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/_files/expected-alerts/alerts-dismissable.phtml b/tests/_files/expected-alerts/alerts-dismissable.phtml index 52fb1f5..2b17c93 100644 --- a/tests/_files/expected-alerts/alerts-dismissable.phtml +++ b/tests/_files/expected-alerts/alerts-dismissable.phtml @@ -1 +1 @@ -
Warning! Best check yo self, you're not looking too good.
+
Warning! Best check yo self, you're not looking too good.
From e6616af25306642212f7410291dc04f1cfd38eb5 Mon Sep 17 00:00:00 2001 From: Mark Garrett Date: Tue, 25 Feb 2014 11:30:52 -0600 Subject: [PATCH 2/3] Allow for blank messages sent to constructor. This will short circuit rendering. --- src/TwbBundle/View/Helper/TwbBundleAlert.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/TwbBundle/View/Helper/TwbBundleAlert.php b/src/TwbBundle/View/Helper/TwbBundleAlert.php index c6205ce..c41056f 100644 --- a/src/TwbBundle/View/Helper/TwbBundleAlert.php +++ b/src/TwbBundle/View/Helper/TwbBundleAlert.php @@ -19,7 +19,8 @@ class TwbBundleAlert extends \Zend\Form\View\Helper\AbstractHelper{ * @return string|\TwbBundle\View\Helper\TwbBundleAlert */ public function __invoke($sAlertMessage = null, $aAlertAttributes = null, $bDismissable = false){ - if(!$sAlertMessage)return $this; + if($sAlertMessage === null) return $this; + if($sAlertMessage == '') return ''; return $this->render($sAlertMessage,$aAlertAttributes,$bDismissable); } From 2333396ae01a63c038905b0b0192070b1dab1557 Mon Sep 17 00:00:00 2001 From: Mark Garrett Date: Tue, 25 Feb 2014 11:44:42 -0600 Subject: [PATCH 3/3] Actually, we want false to return a blank string. Make sure a numeric zero would be passed for rendering. --- src/TwbBundle/View/Helper/TwbBundleAlert.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/TwbBundle/View/Helper/TwbBundleAlert.php b/src/TwbBundle/View/Helper/TwbBundleAlert.php index 485272b..e3963b9 100644 --- a/src/TwbBundle/View/Helper/TwbBundleAlert.php +++ b/src/TwbBundle/View/Helper/TwbBundleAlert.php @@ -20,7 +20,7 @@ class TwbBundleAlert extends \Zend\Form\View\Helper\AbstractHelper{ */ public function __invoke($sAlertMessage = null, $aAlertAttributes = null, $bDismissable = false){ if($sAlertMessage === null) return $this; - if($sAlertMessage == '') return ''; + if($sAlertMessage === '' || $sAlertMessage === false) return ''; return $this->render($sAlertMessage,$aAlertAttributes,$bDismissable); }