Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncEnrollments
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yeray Santana Hualde
syncEnrollments
Commits
f93dfccd
Commit
f93dfccd
authored
Feb 03, 2013
by
Chris How
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
HTML::entities() now optional on label contents
parent
23d23dd0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
2 deletions
+6
-2
form.php
laravel/form.php
+4
-2
form.test.php
laravel/tests/cases/form.test.php
+2
-0
No files found.
laravel/form.php
View file @
f93dfccd
...
@@ -182,13 +182,15 @@ class Form {
...
@@ -182,13 +182,15 @@ class Form {
* @param array $attributes
* @param array $attributes
* @return string
* @return string
*/
*/
public
static
function
label
(
$name
,
$value
,
$attributes
=
array
())
public
static
function
label
(
$name
,
$value
,
$attributes
=
array
()
,
$escape_html
=
true
)
{
{
static
::
$labels
[]
=
$name
;
static
::
$labels
[]
=
$name
;
$attributes
=
HTML
::
attributes
(
$attributes
);
$attributes
=
HTML
::
attributes
(
$attributes
);
if
(
$escape_html
)
{
$value
=
HTML
::
entities
(
$value
);
$value
=
HTML
::
entities
(
$value
);
}
return
'<label for="'
.
$name
.
'"'
.
$attributes
.
'>'
.
$value
.
'</label>'
;
return
'<label for="'
.
$name
.
'"'
.
$attributes
.
'>'
.
$value
.
'</label>'
;
}
}
...
...
laravel/tests/cases/form.test.php
View file @
f93dfccd
...
@@ -111,9 +111,11 @@ class FormTest extends PHPUnit_Framework_TestCase {
...
@@ -111,9 +111,11 @@ class FormTest extends PHPUnit_Framework_TestCase {
{
{
$form1
=
Form
::
label
(
'foo'
,
'Foobar'
);
$form1
=
Form
::
label
(
'foo'
,
'Foobar'
);
$form2
=
Form
::
label
(
'foo'
,
'Foobar'
,
array
(
'class'
=>
'control-label'
));
$form2
=
Form
::
label
(
'foo'
,
'Foobar'
,
array
(
'class'
=>
'control-label'
));
$form3
=
Form
::
label
(
'foo'
,
'Foobar <i>baz</i>'
,
null
,
false
);
$this
->
assertEquals
(
'<label for="foo">Foobar</label>'
,
$form1
);
$this
->
assertEquals
(
'<label for="foo">Foobar</label>'
,
$form1
);
$this
->
assertEquals
(
'<label for="foo" class="control-label">Foobar</label>'
,
$form2
);
$this
->
assertEquals
(
'<label for="foo" class="control-label">Foobar</label>'
,
$form2
);
$this
->
assertEquals
(
'<label for="foo">Foobar <i>baz</i></label>'
,
$form3
);
}
}
/**
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment