Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
X
xmlsitemap
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
xmlsitemap
Commits
ee3b2491
Commit
ee3b2491
authored
May 26, 2014
by
andrei.dincu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#2249723
by andrei.dincu: xmlsitemap_get_link_info() updated to D8
parent
89e60d0f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
9 deletions
+21
-9
xmlsitemap.module
xmlsitemap.module
+21
-9
No files found.
xmlsitemap.module
View file @
ee3b2491
...
...
@@ -777,7 +777,7 @@ function _xmlsitemap_check_changed_link(array $link, $original_link = NULL, $fla
/**
* @} End of "defgroup xmlsitemap_api"
*/
function
xmlsitemap_get_directory
(
XmlSitemapInterface
$sitemap
=
NULL
)
{
function
xmlsitemap_get_directory
(
XmlSitemapInterface
$sitemap
=
NULL
)
{
$directory
=
&
drupal_static
(
__FUNCTION__
);
if
(
!
isset
(
$directory
))
{
$directory
=
\
Drupal
::
config
(
'xmlsitemap.settings'
)
->
get
(
'path'
);
...
...
@@ -907,7 +907,7 @@ function _xmlsitemap_delete_recursive($path, $delete_root = FALSE) {
* @see hook_xmlsitemap_link_info_alter()
*/
function
xmlsitemap_get_link_info
(
$type
=
NULL
,
$reset
=
FALSE
)
{
global
$language
;
$language
=
\
Drupal
::
languageManager
()
->
getCurrentLanguage
()
;
$link_info
=
&
drupal_static
(
__FUNCTION__
);
if
(
$reset
)
{
...
...
@@ -916,24 +916,35 @@ function xmlsitemap_get_link_info($type = NULL, $reset = FALSE) {
}
if
(
!
isset
(
$link_info
))
{
$cid
=
'xmlsitemap:link_info:'
.
$language
->
language
;
$cid
=
'xmlsitemap:link_info:'
.
$language
->
getId
()
;
if
(
$cache
=
\
Drupal
::
cache
()
->
get
(
$cid
))
{
$link_info
=
$cache
->
data
;
}
else
{
entity_info_cache_clear
();
$link_info
=
entity_get_info
();
foreach
(
$link_info
as
$key
=>
$info
)
{
if
(
empty
(
$info
[
'uri callback'
])
||
!
isset
(
$info
[
'xmlsitemap'
]))
{
$link_info
=
array
();
$entity_types
=
\
Drupal
::
entityManager
()
->
getDefinitions
();
foreach
(
$entity_types
as
$key
=>
$entity_type
)
{
$link_info
[
$key
]
=
array
(
'label'
=>
$entity_type
->
getLabel
(),
'type'
=>
$entity_type
->
id
(),
'base table'
=>
$entity_type
->
getBaseTable
(),
'bundles'
=>
\
Drupal
::
entityManager
()
->
getBundleInfo
(
$entity_type
->
id
())
);
$uri_callback
=
$entity_type
->
getUriCallback
();
if
(
empty
(
$uri_callback
)
||
!
isset
(
$entity_type
->
xmlsitemap
))
{
// Remove any non URL-able or XML sitemap un-supported entites.
unset
(
$entity_types
[
$key
]);
unset
(
$link_info
[
$key
]);
}
foreach
(
$info
[
'bundles'
]
as
$bundle_key
=>
$bundle
)
{
foreach
(
\
Drupal
::
entityManager
()
->
getBundleInfo
(
$entity_type
->
id
())
as
$bundle_key
=>
$bundle
)
{
if
(
!
isset
(
$bundle
[
'xmlsitemap'
]))
{
// Remove any un-supported entity bundles.
//unset($link_info[$key]['bundles'][$bundle_key]);
}
}
unset
(
$entity_types
[
$key
]);
unset
(
$link_info
[
$key
]);
}
$link_info
=
array_merge
(
$link_info
,
module_invoke_all
(
'xmlsitemap_link_info'
));
foreach
(
$link_info
as
$key
=>
&
$info
)
{
...
...
@@ -953,7 +964,8 @@ function xmlsitemap_get_link_info($type = NULL, $reset = FALSE) {
$bundle_info
[
'xmlsitemap'
]
+=
xmlsitemap_link_bundle_load
(
$key
,
$bundle
,
FALSE
);
}
}
drupal_alter
(
'xmlsitemap_link_info'
,
$link_info
);
//drupal_alter('xmlsitemap_link_info', $link_info);
\
Drupal
::
moduleHandler
()
->
alter
(
'xmlsitemap_link_info'
,
$link_info
);
ksort
(
$link_info
);
// Cache by language since this info contains translated strings.
\
Drupal
::
cache
()
->
set
(
$cid
,
$link_info
);
...
...
@@ -1069,7 +1081,7 @@ function xmlsitemap_link_bundle_load($entity, $bundle, $load_bundle_info = TRUE)
$info
[
'info'
]
=
$entity_info
[
'bundles'
][
$bundle
];
}
}
$info
+=
\
Drupal
::
config
(
'xmlsitemap.settings'
)
->
get
(
"xmlsitemap_settings_
{
$entity
}
_
{
$bundle
}
"
);
//
$info += \Drupal::config('xmlsitemap.settings')->get("xmlsitemap_settings_{$entity}_{$bundle}");
$info
+=
array
(
'status'
=>
XMLSITEMAP_STATUS_DEFAULT
,
'priority'
=>
XMLSITEMAP_PRIORITY_DEFAULT
,
...
...
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