Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
project
drupal
Commits
c44404a3
Commit
c44404a3
authored
Apr 11, 2013
by
alexpott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#1957670
by larowlan | sreynen: Fixed Link field labels don't show in entity forms.
parent
dad84f02
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
0 deletions
+14
-0
core/modules/link/lib/Drupal/link/Tests/LinkFieldTest.php
core/modules/link/lib/Drupal/link/Tests/LinkFieldTest.php
+6
-0
core/modules/link/link.module
core/modules/link/link.module
+8
-0
No files found.
core/modules/link/lib/Drupal/link/Tests/LinkFieldTest.php
View file @
c44404a3
...
...
@@ -121,6 +121,7 @@ function testLinkTitle() {
'field_name'
=>
$this
->
field
[
'field_name'
],
'entity_type'
=>
'test_entity'
,
'bundle'
=>
'test_bundle'
,
'label'
=>
'Read more about this entity'
,
'settings'
=>
array
(
'title'
=>
DRUPAL_OPTIONAL
,
),
...
...
@@ -150,6 +151,8 @@ function testLinkTitle() {
// Display creation form.
$this
->
drupalGet
(
'test-entity/add/test_bundle'
);
// Assert label is shown.
$this
->
assertText
(
'Read more about this entity'
);
$this
->
assertFieldByName
(
"
{
$this
->
field
[
'field_name'
]
}
[
$langcode
][0][url]"
,
''
,
'URL field found.'
);
$this
->
assertRaw
(
'placeholder="http://example.com"'
);
...
...
@@ -230,6 +233,7 @@ function testLinkFormatter() {
$this
->
instance
=
array
(
'field_name'
=>
$this
->
field
[
'field_name'
],
'entity_type'
=>
'test_entity'
,
'label'
=>
'Read more about this entity'
,
'bundle'
=>
'test_bundle'
,
'settings'
=>
array
(
'title'
=>
DRUPAL_OPTIONAL
,
...
...
@@ -267,6 +271,8 @@ function testLinkFormatter() {
"
{
$this
->
field
[
'field_name'
]
}
[
$langcode
][1][url]"
=>
$url2
,
"
{
$this
->
field
[
'field_name'
]
}
[
$langcode
][1][title]"
=>
$title2
,
);
// Assert label is shown.
$this
->
assertText
(
'Read more about this entity'
);
$this
->
drupalPost
(
NULL
,
$edit
,
t
(
'Save'
));
preg_match
(
'|test-entity/manage/(\d+)/edit|'
,
$this
->
url
,
$match
);
$id
=
$match
[
1
];
...
...
core/modules/link/link.module
View file @
c44404a3
...
...
@@ -176,6 +176,14 @@ function link_field_widget_form(&$form, &$form_state, $field, $instance, $langco
'#attributes'
=>
array
(
'class'
=>
array
(
'link-field-widget-attributes'
)),
);
// If cardinality is 1, ensure a label is output for the field by wrapping it
// in a details element.
if
(
$field
[
'cardinality'
]
==
1
)
{
$element
+=
array
(
'#type'
=>
'fieldset'
,
);
}
return
$element
;
}
...
...
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