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
6eafe72d
Unverified
Commit
6eafe72d
authored
Jan 08, 2018
by
larowlan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#2934096
by kiamlaluno, joelpittet: Simplify the ListDataDefinition::getClass() code
parent
a9d3f0ab
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
12 deletions
+10
-12
core/lib/Drupal/Core/TypedData/ListDataDefinition.php
core/lib/Drupal/Core/TypedData/ListDataDefinition.php
+10
-12
No files found.
core/lib/Drupal/Core/TypedData/ListDataDefinition.php
View file @
6eafe72d
...
...
@@ -72,20 +72,18 @@ public function setDataType($type) {
* {@inheritdoc}
*/
public
function
getClass
()
{
$class
=
isset
(
$this
->
definition
[
'class'
])
?
$this
->
definition
[
'class'
]
:
NULL
;
if
(
!
empty
(
$class
))
{
return
$class
;
if
(
!
empty
(
$this
->
definition
[
'class'
]))
{
return
$this
->
definition
[
'class'
];
}
else
{
// If a list definition is used but no class has been specified, derive
// the default list class from the item type.
$item_type_definition
=
\
Drupal
::
typedDataManager
()
->
getDefinition
(
$this
->
getItemDefinition
()
->
getDataType
());
if
(
!
$item_type_definition
)
{
throw
new
\
LogicException
(
"An invalid data type '
{
$this
->
getItemDefinition
()
->
getDataType
()
}
' has been specified for list items"
);
}
return
$item_type_definition
[
'list_class'
];
// If a list definition is used but no class has been specified, derive the
// default list class from the item type.
$item_type_definition
=
\
Drupal
::
typedDataManager
()
->
getDefinition
(
$this
->
getItemDefinition
()
->
getDataType
());
if
(
!
$item_type_definition
)
{
throw
new
\
LogicException
(
"An invalid data type '
{
$this
->
getItemDefinition
()
->
getDataType
()
}
' has been specified for list items"
);
}
return
$item_type_definition
[
'list_class'
];
}
/**
...
...
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