Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
xmlsitemap
Commits
5ca1c882
Unverified
Commit
5ca1c882
authored
Sep 26, 2018
by
Dave Reid
Committed by
Dave Reid
Sep 26, 2018
Browse files
Issue
#3002577
by Dave Reid: Fixed coding standards in XmlSitemapListBuilder.
parent
c1c56549
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/XmlSitemapListBuilder.php
View file @
5ca1c882
...
...
@@ -4,12 +4,12 @@ namespace Drupal\xmlsitemap;
use
Drupal\Core\Config\Entity\ConfigEntityListBuilder
;
use
Drupal\Core\Entity\EntityInterface
;
use
Drupal\Core\Entity\EntityTypeInterface
;
use
Drupal\Core\Entity\EntityStorageInterface
;
use
Symfony\Component\DependencyInjection\Container
Interface
;
use
Drupal\Core\Entity\EntityType
Interface
;
use
Drupal\Core\Extension\ModuleHandlerInterface
;
use
Drupal\Core\Language\LanguageManagerInterface
;
use
Drupal\core\Language\LanguageInterface
;
use
Drupal\Core\Language\LanguageManagerInterface
;
use
Symfony\Component\DependencyInjection\ContainerInterface
;
/**
* Provides a listing of XmlSitemap.
...
...
@@ -53,7 +53,10 @@ class XmlSitemapListBuilder extends ConfigEntityListBuilder {
*/
public
static
function
createInstance
(
ContainerInterface
$container
,
EntityTypeInterface
$entity_type
)
{
return
new
static
(
$entity_type
,
$container
->
get
(
'entity.manager'
)
->
getStorage
(
$entity_type
->
id
()),
$container
->
get
(
'module_handler'
),
$container
->
get
(
'language_manager'
)
$entity_type
,
$container
->
get
(
'entity.manager'
)
->
getStorage
(
$entity_type
->
id
()),
$container
->
get
(
'module_handler'
),
$container
->
get
(
'language_manager'
)
);
}
...
...
@@ -81,16 +84,17 @@ class XmlSitemapListBuilder extends ConfigEntityListBuilder {
* {@inheritdoc}
*/
public
function
buildRow
(
EntityInterface
$entity
)
{
$row
[
'label'
]
=
$this
->
getLabel
(
$entity
);
/** @var \Drupal\xmlsitemap\XmlSitemapInterface $entity */
$row
[
'label'
]
=
$entity
->
label
();
if
(
$this
->
moduleHandler
->
moduleExists
(
'language'
))
{
if
(
isset
(
$entity
->
c
ontext
[
'language'
]))
{
$language
=
$this
->
languageManager
->
getLanguage
(
$entity
->
c
ontext
[
'language'
]);
if
(
isset
(
$entity
->
getC
ontext
()
[
'language'
]))
{
$language
=
$this
->
languageManager
->
getLanguage
(
$entity
->
getC
ontext
()
[
'language'
]);
// In some cases ::getLanguage() can return NULL value.
if
(
!
is_null
(
$language
)
&&
(
$language
instanceof
LanguageInterface
))
{
$row
[
'language'
]
=
$language
->
getName
();
}
else
{
\
Drupal
::
logger
(
'xmlsitemap'
)
->
error
(
'Can
\'
t determine language for
entity with
@id'
,
array
(
'@id'
=>
$entity
->
id
()
)
);
\
Drupal
::
logger
(
'xmlsitemap'
)
->
notice
(
'Can
no
t determine language for
sitemap
@id'
,
[
'@id'
=>
$entity
->
id
()
]
);
// Set as default row value.
$row
[
'language'
]
=
$this
->
t
(
'Undefined'
);
}
...
...
@@ -108,10 +112,13 @@ class XmlSitemapListBuilder extends ConfigEntityListBuilder {
* {@inheritdoc}
*/
public
function
getOperations
(
EntityInterface
$entity
)
{
/** @var \Drupal\xmlsitemap\XmlSitemapInterface $entity */
$operations
=
parent
::
getOperations
(
$entity
);
if
(
isset
(
$operations
[
'translate'
]))
{
unset
(
$operations
[
'translate'
]);
}
return
$operations
;
}
...
...
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