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
xmlsitemap
Commits
30dfe207
Commit
30dfe207
authored
Jun 17, 2014
by
andrei.dincu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#2249723
by andrei.dincu: Add type checking in xmlsitemap.module for user hooks
parent
4d791a3f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
11 deletions
+14
-11
xmlsitemap.module
xmlsitemap.module
+14
-11
No files found.
xmlsitemap.module
View file @
30dfe207
...
...
@@ -13,6 +13,8 @@ use Drupal\Component\Utility\Crypt;
use
Drupal\Core\Session\UserSession
;
use
Drupal\Core\Language\LanguageInterface
;
use
Drupal\xmlsitemap\XmlSitemapInterface
;
use
Drupal\user\Entity\User
;
use
Drupal\user\UserInterface
;
/**
* The maximum number of links in one sitemap chunk file.
...
...
@@ -614,11 +616,13 @@ function xmlsitemap_link_save(array $link) {
// Save the link and allow other modules to respond to the link being saved.
if
(
$existing
)
{
print
"ana are mere"
.
PHP_EOL
;
drupal_write_record
(
'xmlsitemap'
,
$link
,
array
(
'type'
,
'id'
));
\
Drupal
::
moduleHandler
()
->
invokeAll
(
'xmlsitemap_link_update'
,
$link
);
}
else
{
drupal_write_record
(
'xmlsitemap'
,
$link
);
print
"bogdan are mere"
.
PHP_EOL
;
$result
=
drupal_write_record
(
'xmlsitemap'
,
$link
);
\
Drupal
::
moduleHandler
()
->
invokeAll
(
'xmlsitemap_link_insert'
,
$link
);
}
...
...
@@ -1611,18 +1615,18 @@ function xmlsitemap_user_xmlsitemap_process_user_links(array $uids) {
if
(
!
\
Drupal
::
state
()
->
get
(
'xmlsitemap_entity_user'
))
{
return
;
}
$accounts
=
u
ser
_
load
_m
ultiple
(
$uids
);
$accounts
=
U
ser
::
load
M
ultiple
(
$uids
);
foreach
(
$accounts
as
$account
)
{
$link
=
xmlsitemap_user_create_link
(
$account
);
xmlsitemap_link_save
(
$link
);
print
var_dump
(
$account
->
id
);
//$link = xmlsitemap_user_create_link($account);
//xmlsitemap_link_save($link);
}
}
/**
* Implements hook_user_presave().
*/
function
xmlsitemap_user_presave
(
&
$edit
,
$account
,
$category
)
{
drupal_set_message
(
'ana are mere'
);
function
xmlsitemap_user_presave
(
UserInterface
$account
)
{
if
(
!
\
Drupal
::
state
()
->
get
(
'xmlsitemap_entity_user'
))
{
return
;
}
...
...
@@ -1640,7 +1644,7 @@ function xmlsitemap_user_presave(&$edit, $account, $category) {
/**
* Implements hook_user_insert().
*/
function
xmlsitemap_user_insert
(
&
$edit
,
$account
,
$category
)
{
function
xmlsitemap_user_insert
(
UserInterface
$account
)
{
if
(
!
\
Drupal
::
state
()
->
get
(
'xmlsitemap_entity_user'
))
{
return
;
}
...
...
@@ -1651,7 +1655,7 @@ function xmlsitemap_user_insert(&$edit, $account, $category) {
/**
* Implements hook_user_update().
*/
function
xmlsitemap_user_update
(
&
$edit
,
$account
,
$category
)
{
function
xmlsitemap_user_update
(
UserInterface
$account
)
{
if
(
!
\
Drupal
::
state
()
->
get
(
'xmlsitemap_entity_user'
))
{
return
;
}
...
...
@@ -1662,7 +1666,7 @@ function xmlsitemap_user_update(&$edit, $account, $category) {
/**
* Implements hook_user_delete().
*/
function
xmlsitemap_user_delete
(
$account
)
{
function
xmlsitemap_user_delete
(
UserInterface
$account
)
{
xmlsitemap_link_delete
(
'user'
,
$account
->
uid
);
}
...
...
@@ -1686,7 +1690,7 @@ function xmlsitemap_field_extra_fields() {
* @param $account
* A user object.
*/
function
xmlsitemap_user_create_link
(
&
$account
)
{
function
xmlsitemap_user_create_link
(
UserInterface
&
$account
)
{
if
(
!
isset
(
$account
->
xmlsitemap
))
{
$account
->
xmlsitemap
=
array
();
if
(
$account
->
uid
&&
$link
=
xmlsitemap_link_load
(
'user'
,
$account
->
uid
))
{
...
...
@@ -1695,7 +1699,6 @@ function xmlsitemap_user_create_link(&$account) {
}
$settings
=
xmlsitemap_link_bundle_load
(
'user'
,
'user'
);
//$uri = entity_uri('user', $account);
$uri
=
$account
->
uri
;
$account
->
xmlsitemap
+=
array
(
'type'
=>
'user'
,
...
...
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