Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
46f8c743
Commit
46f8c743
authored
Dec 19, 2011
by
Dries Buytaert
Browse files
- Patch
#1146088
by lyricnz: label always visible for table formatter.
parent
7be846e7
Changes
3
Hide whitespace changes
Inline
Side-by-side
core/modules/field/tests/field_test.field.inc
View file @
46f8c743
...
...
@@ -350,11 +350,13 @@ function field_test_field_formatter_view($entity_type, $entity, $field, $instanc
break
;
case
'field_test_multiple'
:
$array
=
array
();
foreach
(
$items
as
$delta
=>
$item
)
{
$array
[]
=
$delta
.
':'
.
$item
[
'value'
];
if
(
!
empty
(
$items
))
{
$array
=
array
();
foreach
(
$items
as
$delta
=>
$item
)
{
$array
[]
=
$delta
.
':'
.
$item
[
'value'
];
}
$element
[
0
]
=
array
(
'#markup'
=>
$settings
[
'test_formatter_setting_multiple'
]
.
'|'
.
implode
(
'|'
,
$array
));
}
$element
[
0
]
=
array
(
'#markup'
=>
$settings
[
'test_formatter_setting_multiple'
]
.
'|'
.
implode
(
'|'
,
$array
));
break
;
}
...
...
core/modules/file/file.field.inc
View file @
46f8c743
...
...
@@ -993,11 +993,13 @@ function file_field_formatter_view($entity_type, $entity, $field, $instance, $la
break
;
case
'file_table'
:
// Display all values in a single element..
$element
[
0
]
=
array
(
'#theme'
=>
'file_formatter_table'
,
'#items'
=>
$items
,
);
if
(
!
empty
(
$items
))
{
// Display all values in a single element..
$element
[
0
]
=
array
(
'#theme'
=>
'file_formatter_table'
,
'#items'
=>
$items
,
);
}
break
;
}
...
...
core/modules/file/tests/file.test
View file @
46f8c743
...
...
@@ -760,6 +760,19 @@ class FileFieldDisplayTestCase extends FileFieldTestCase {
$field
=
field_info_field
(
$field_name
);
$instance
=
field_info_instance
(
'node'
,
$field_name
,
$type_name
);
// Create a new node *without* the file field set, and check that the field
// is not shown for each node display.
$node
=
$this
->
drupalCreateNode
(
array
(
'type'
=>
$type_name
));
$file_formatters
=
array
(
'file_default'
,
'file_table'
,
'file_url_plain'
,
'hidden'
);
foreach
(
$file_formatters
as
$formatter
)
{
$edit
=
array
(
"fields[
$field_name
][type]"
=>
$formatter
,
);
$this
->
drupalPost
(
"admin/structure/types/manage/
$type_name
/display"
,
$edit
,
t
(
'Save'
));
$this
->
drupalGet
(
'node/'
.
$node
->
nid
);
$this
->
assertNoText
(
$field_name
,
t
(
'Field label is hidden when no file attached for formatter %formatter'
,
array
(
'%formatter'
=>
$formatter
)));
}
$test_file
=
$this
->
getTestFile
(
'text'
);
// Create a new node with the uploaded file.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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