Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
394862da
Commit
394862da
authored
Nov 26, 2012
by
catch
Browse files
Issue
#1848040
by yched: Fixed Fatal error on 'Manage display' after creating new field.
parent
5b6721a2
Changes
2
Hide whitespace changes
Inline
Side-by-side
core/modules/field_ui/lib/Drupal/field_ui/DisplayOverview.php
View file @
394862da
...
...
@@ -101,7 +101,18 @@ public function form(array $form, array &$form_state) {
// Field rows.
foreach
(
$instances
as
$name
=>
$instance
)
{
$field
=
field_info_field
(
$instance
[
'field_name'
]);
$display
=
$instance
[
'display'
][
$this
->
view_mode
];
if
(
isset
(
$instance
[
'display'
][
$this
->
view_mode
]))
{
$display
=
$instance
[
'display'
][
$this
->
view_mode
];
}
else
{
$display
=
array
(
'type'
=>
'hidden'
,
'label'
=>
'above'
,
'weight'
=>
0
,
);
}
$table
[
$name
]
=
array
(
'#attributes'
=>
array
(
'class'
=>
array
(
'draggable'
,
'tabledrag-leaf'
)),
'#row_type'
=>
'field'
,
...
...
core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageDisplayTest.php
View file @
394862da
...
...
@@ -167,6 +167,27 @@ function testViewModeCustom() {
$this
->
assertNodeViewNoText
(
$node
,
'rss'
,
$value
,
"The previous settings are kept when 'rss' mode is specialized again."
);
}
/**
* Tests that field instances with no explicit display settings do not break.
*/
function
testNonInitializedFields
()
{
// Create a test field.
$edit
=
array
(
'fields[_add_new_field][label]'
=>
'Test'
,
'fields[_add_new_field][field_name]'
=>
'test'
,
);
$this
->
fieldUIAddNewField
(
'admin/structure/types/manage/'
.
$this
->
type
,
$edit
);
// Check that no settings have been set for the 'teaser' mode.
$instance
=
field_info_instance
(
'node'
,
'field_test'
,
$this
->
type
);
$this
->
assertFalse
(
isset
(
$instance
[
'display'
][
'teaser'
]));
// Check that the field appears as 'hidden' on the 'Manage display' page
// for the 'teaser' mode.
$this
->
drupalGet
(
'admin/structure/types/manage/'
.
$this
->
type
.
'/display/teaser'
);
$this
->
assertFieldByName
(
'fields[field_test][type]'
,
'hidden'
,
'The field is displayed as \'hidden \'.'
);
}
/**
* Tests hiding the view modes fieldset when there's only one available.
*/
...
...
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