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
46284d2e
Commit
46284d2e
authored
Mar 30, 2013
by
Angie Byron
Browse files
Issue
#1927884
by Alan D., swentel: Always return an array from field_get_items().
parent
e8ee8008
Changes
2
Hide whitespace changes
Inline
Side-by-side
core/modules/field/field.module
View file @
46284d2e
...
...
@@ -991,12 +991,12 @@ function field_view_field(EntityInterface $entity, $field_name, $display_options
* Defaults to the current language.
*
* @return
* An array
of
field items keyed by delta
if available, FALSE otherwise
.
* An array
with available
field items keyed by delta.
*/
function
field_get_items
(
EntityInterface
$entity
,
$field_name
,
$langcode
=
NULL
)
{
$entity
=
$entity
->
getBCEntity
();
$langcode
=
field_language
(
$entity
,
$field_name
,
$langcode
);
return
isset
(
$entity
->
{
$field_name
}[
$langcode
])
?
$entity
->
{
$field_name
}[
$langcode
]
:
FALSE
;
return
isset
(
$entity
->
{
$field_name
}[
$langcode
])
?
$entity
->
{
$field_name
}[
$langcode
]
:
array
()
;
}
/**
...
...
core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument_default/Tid.php
View file @
46284d2e
...
...
@@ -139,11 +139,8 @@ function get_argument() {
foreach
(
$fields
as
$name
=>
$info
)
{
$field_info
=
field_info_field
(
$name
);
if
(
$field_info
[
'type'
]
==
'taxonomy_term_reference'
)
{
$items
=
field_get_items
(
$node
,
$name
);
if
(
is_array
(
$items
))
{
foreach
(
$items
as
$item
)
{
$taxonomy
[
$item
[
'tid'
]]
=
$field_info
[
'settings'
][
'allowed_values'
][
0
][
'vocabulary'
];
}
foreach
(
field_get_items
(
$node
,
$name
)
as
$item
)
{
$taxonomy
[
$item
[
'tid'
]]
=
$field_info
[
'settings'
][
'allowed_values'
][
0
][
'vocabulary'
];
}
}
}
...
...
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