From f93dfccd21372bd963f6d3ea1da486731eba8b6a Mon Sep 17 00:00:00 2001 From: Chris How Date: Sun, 3 Feb 2013 19:15:55 +0100 Subject: [PATCH] HTML::entities() now optional on label contents --- laravel/form.php | 6 ++++-- laravel/tests/cases/form.test.php | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/laravel/form.php b/laravel/form.php index 5a450b52..d14cad69 100644 --- a/laravel/form.php +++ b/laravel/form.php @@ -182,13 +182,15 @@ class Form { * @param array $attributes * @return string */ - public static function label($name, $value, $attributes = array()) + public static function label($name, $value, $attributes = array(), $escape_html = true) { static::$labels[] = $name; $attributes = HTML::attributes($attributes); - $value = HTML::entities($value); + if ($escape_html) { + $value = HTML::entities($value); + } return ''; } diff --git a/laravel/tests/cases/form.test.php b/laravel/tests/cases/form.test.php index 5f6f7fa3..8791dfd1 100644 --- a/laravel/tests/cases/form.test.php +++ b/laravel/tests/cases/form.test.php @@ -111,9 +111,11 @@ class FormTest extends PHPUnit_Framework_TestCase { { $form1 = Form::label('foo', 'Foobar'); $form2 = Form::label('foo', 'Foobar', array('class' => 'control-label')); + $form3 = Form::label('foo', 'Foobar baz', null, false); $this->assertEquals('', $form1); $this->assertEquals('', $form2); + $this->assertEquals('', $form3); } /**