Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
S
simple_sitemap
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
3
Merge Requests
3
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
simple_sitemap
Commits
bb0fbae5
Commit
bb0fbae5
authored
Dec 19, 2017
by
Pawel G
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up
parent
cc325973
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
20 additions
and
21 deletions
+20
-21
src/EntityHelper.php
src/EntityHelper.php
+10
-11
src/Form/FormHelper.php
src/Form/FormHelper.php
+3
-3
src/Form/SimplesitemapCustomLinksForm.php
src/Form/SimplesitemapCustomLinksForm.php
+1
-1
src/Form/SimplesitemapEntitiesForm.php
src/Form/SimplesitemapEntitiesForm.php
+1
-1
src/Form/SimplesitemapSettingsForm.php
src/Form/SimplesitemapSettingsForm.php
+1
-1
src/Plugin/simple_sitemap/UrlGenerator/EntityUrlGenerator.php
...Plugin/simple_sitemap/UrlGenerator/EntityUrlGenerator.php
+1
-1
src/Plugin/simple_sitemap/UrlGenerator/UrlGeneratorBase.php
src/Plugin/simple_sitemap/UrlGenerator/UrlGeneratorBase.php
+1
-1
src/Simplesitemap.php
src/Simplesitemap.php
+2
-2
No files found.
src/EntityHelper.php
View file @
bb0fbae5
...
@@ -41,7 +41,7 @@ class EntityHelper {
...
@@ -41,7 +41,7 @@ class EntityHelper {
* @return string
* @return string
*/
*/
public
function
getEntityInstanceBundleName
(
EntityInterface
$entity
)
{
public
function
getEntityInstanceBundleName
(
EntityInterface
$entity
)
{
return
$entity
->
getEntityTypeId
()
==
'menu_link_content'
return
$entity
->
getEntityTypeId
()
==
=
'menu_link_content'
// Menu fix.
// Menu fix.
?
$entity
->
getMenuName
()
:
$entity
->
bundle
();
?
$entity
->
getMenuName
()
:
$entity
->
bundle
();
}
}
...
@@ -53,7 +53,7 @@ class EntityHelper {
...
@@ -53,7 +53,7 @@ class EntityHelper {
* @return null|string
* @return null|string
*/
*/
public
function
getBundleEntityTypeId
(
EntityInterface
$entity
)
{
public
function
getBundleEntityTypeId
(
EntityInterface
$entity
)
{
return
$entity
->
getEntityTypeId
()
==
'menu'
return
$entity
->
getEntityTypeId
()
==
=
'menu'
// Menu fix.
// Menu fix.
?
'menu_link_content'
:
$entity
->
getEntityType
()
->
getBundleOf
();
?
'menu_link_content'
:
$entity
->
getEntityType
()
->
getBundleOf
();
}
}
...
@@ -84,20 +84,19 @@ class EntityHelper {
...
@@ -84,20 +84,19 @@ class EntityHelper {
* @return bool
* @return bool
*/
*/
public
function
entityTypeIsAtomic
(
$entity_type_id
)
{
public
function
entityTypeIsAtomic
(
$entity_type_id
)
{
// Menu fix.
// Menu fix.
if
(
$entity_type_id
==
'menu_link_content'
)
{
if
(
$entity_type_id
==
=
'menu_link_content'
)
{
return
FALSE
;
return
FALSE
;
}
}
$sitemap_entity_types
=
$this
->
getSupportedEntityTypes
();
$entity_types
=
$this
->
entityTypeManager
->
getDefinitions
();
if
(
isset
(
$sitemap_entity_types
[
$entity_type_id
]))
{
$entity_type
=
$sitemap_entity_types
[
$entity_type_id
];
if
(
!
isset
(
$entity_types
[
$entity_type_id
]))
{
if
(
empty
(
$entity_type
->
getBundleEntityType
()))
{
// todo: Throw exception.
return
TRUE
;
}
}
}
// todo: throw exception.
return
FALSE
;
return
empty
(
$entity_types
[
$entity_type_id
]
->
getBundleEntityType
())
?
TRUE
:
FALSE
;
}
}
/**
/**
...
...
src/Form/FormHelper.php
View file @
bb0fbae5
...
@@ -197,7 +197,7 @@ class FormHelper {
...
@@ -197,7 +197,7 @@ class FormHelper {
// Do not alter the form, if sitemap is disabled for the entity type of this
// Do not alter the form, if sitemap is disabled for the entity type of this
// entity instance.
// entity instance.
elseif
(
$this
->
getEntityCategory
()
==
'instance'
elseif
(
$this
->
getEntityCategory
()
==
=
'instance'
&&
!
$this
->
generator
->
bundleIsIndexed
(
$this
->
getEntityTypeId
(),
$this
->
getBundleName
()))
{
&&
!
$this
->
generator
->
bundleIsIndexed
(
$this
->
getEntityTypeId
(),
$this
->
getBundleName
()))
{
return
FALSE
;
return
FALSE
;
}
}
...
@@ -317,7 +317,7 @@ class FormHelper {
...
@@ -317,7 +317,7 @@ class FormHelper {
* TRUE if this is a bundle or bundle instance form, FALSE otherwise.
* TRUE if this is a bundle or bundle instance form, FALSE otherwise.
*/
*/
protected
function
getEntityDataFromFormEntity
()
{
protected
function
getEntityDataFromFormEntity
()
{
if
(
FALSE
===
$form_entity
=
$this
->
getFormEntity
())
{
if
(
!
$form_entity
=
$this
->
getFormEntity
())
{
return
FALSE
;
return
FALSE
;
}
}
...
@@ -339,7 +339,7 @@ class FormHelper {
...
@@ -339,7 +339,7 @@ class FormHelper {
}
}
// Menu fix.
// Menu fix.
$this
->
setEntityCategory
(
NULL
===
$this
->
getEntityCategory
()
&&
$entity_type_id
==
'menu'
?
'bundle'
:
$this
->
getEntityCategory
());
$this
->
setEntityCategory
(
NULL
===
$this
->
getEntityCategory
()
&&
$entity_type_id
==
=
'menu'
?
'bundle'
:
$this
->
getEntityCategory
());
switch
(
$this
->
getEntityCategory
())
{
switch
(
$this
->
getEntityCategory
())
{
case
'bundle'
:
case
'bundle'
:
...
...
src/Form/SimplesitemapCustomLinksForm.php
View file @
bb0fbae5
...
@@ -71,7 +71,7 @@ class SimplesitemapCustomLinksForm extends SimplesitemapFormBase {
...
@@ -71,7 +71,7 @@ class SimplesitemapCustomLinksForm extends SimplesitemapFormBase {
}
}
// Making sure the paths start with a slash.
// Making sure the paths start with a slash.
if
(
$link_config
[
'path'
][
0
]
!=
'/'
)
{
if
(
$link_config
[
'path'
][
0
]
!=
=
'/'
)
{
$form_state
->
setErrorByName
(
''
,
$this
->
t
(
"<strong>Line @line</strong>: The path <em>@path</em> needs to start with a '/'."
,
$placeholders
));
$form_state
->
setErrorByName
(
''
,
$this
->
t
(
"<strong>Line @line</strong>: The path <em>@path</em> needs to start with a '/'."
,
$placeholders
));
}
}
...
...
src/Form/SimplesitemapEntitiesForm.php
View file @
bb0fbae5
...
@@ -88,7 +88,7 @@ class SimplesitemapEntitiesForm extends SimplesitemapFormBase {
...
@@ -88,7 +88,7 @@ class SimplesitemapEntitiesForm extends SimplesitemapFormBase {
public
function
submitForm
(
array
&
$form
,
FormStateInterface
$form_state
)
{
public
function
submitForm
(
array
&
$form
,
FormStateInterface
$form_state
)
{
$values
=
$form_state
->
getValues
();
$values
=
$form_state
->
getValues
();
foreach
(
$values
as
$field_name
=>
$value
)
{
foreach
(
$values
as
$field_name
=>
$value
)
{
if
(
substr
(
$field_name
,
-
strlen
(
'_enabled'
))
==
'_enabled'
)
{
if
(
substr
(
$field_name
,
-
strlen
(
'_enabled'
))
==
=
'_enabled'
)
{
$entity_type_id
=
substr
(
$field_name
,
0
,
-
8
);
$entity_type_id
=
substr
(
$field_name
,
0
,
-
8
);
if
(
$value
)
{
if
(
$value
)
{
$this
->
generator
->
enableEntityType
(
$entity_type_id
);
$this
->
generator
->
enableEntityType
(
$entity_type_id
);
...
...
src/Form/SimplesitemapSettingsForm.php
View file @
bb0fbae5
...
@@ -154,7 +154,7 @@ class SimplesitemapSettingsForm extends SimplesitemapFormBase {
...
@@ -154,7 +154,7 @@ class SimplesitemapSettingsForm extends SimplesitemapFormBase {
public
function
validateForm
(
array
&
$form
,
FormStateInterface
$form_state
)
{
public
function
validateForm
(
array
&
$form
,
FormStateInterface
$form_state
)
{
$base_url
=
$form_state
->
getValue
(
'base_url'
);
$base_url
=
$form_state
->
getValue
(
'base_url'
);
$form_state
->
setValue
(
'base_url'
,
rtrim
(
$base_url
,
'/'
));
$form_state
->
setValue
(
'base_url'
,
rtrim
(
$base_url
,
'/'
));
if
(
$base_url
!=
''
&&
!
UrlHelper
::
isValid
(
$base_url
,
TRUE
))
{
if
(
$base_url
!=
=
''
&&
!
UrlHelper
::
isValid
(
$base_url
,
TRUE
))
{
$form_state
->
setErrorByName
(
'base_url'
,
t
(
'The base URL is invalid.'
));
$form_state
->
setErrorByName
(
'base_url'
,
t
(
'The base URL is invalid.'
));
}
}
}
}
...
...
src/Plugin/simple_sitemap/UrlGenerator/EntityUrlGenerator.php
View file @
bb0fbae5
...
@@ -25,7 +25,7 @@ class EntityUrlGenerator extends UrlGeneratorBase {
...
@@ -25,7 +25,7 @@ class EntityUrlGenerator extends UrlGeneratorBase {
$keys
=
$sitemap_entity_types
[
$entity_type_name
]
->
getKeys
();
$keys
=
$sitemap_entity_types
[
$entity_type_name
]
->
getKeys
();
// Menu fix.
// Menu fix.
$keys
[
'bundle'
]
=
$entity_type_name
==
'menu_link_content'
?
'menu_name'
:
$keys
[
'bundle'
];
$keys
[
'bundle'
]
=
$entity_type_name
==
=
'menu_link_content'
?
'menu_name'
:
$keys
[
'bundle'
];
foreach
(
$bundles
as
$bundle_name
=>
$bundle_settings
)
{
foreach
(
$bundles
as
$bundle_name
=>
$bundle_settings
)
{
if
(
$bundle_settings
[
'index'
])
{
if
(
$bundle_settings
[
'index'
])
{
...
...
src/Plugin/simple_sitemap/UrlGenerator/UrlGeneratorBase.php
View file @
bb0fbae5
...
@@ -155,7 +155,7 @@ abstract class UrlGeneratorBase extends SimplesitemapPluginBase implements UrlGe
...
@@ -155,7 +155,7 @@ abstract class UrlGeneratorBase extends SimplesitemapPluginBase implements UrlGe
* @return bool
* @return bool
*/
*/
protected
function
isBatch
()
{
protected
function
isBatch
()
{
return
$this
->
batchSettings
[
'from'
]
!=
'nobatch'
;
return
$this
->
batchSettings
[
'from'
]
!=
=
'nobatch'
;
}
}
protected
function
getProcessedElements
()
{
protected
function
getProcessedElements
()
{
...
...
src/Simplesitemap.php
View file @
bb0fbae5
...
@@ -392,7 +392,7 @@ class Simplesitemap {
...
@@ -392,7 +392,7 @@ class Simplesitemap {
$keys
=
$entity_type
->
getKeys
();
$keys
=
$entity_type
->
getKeys
();
// Menu fix.
// Menu fix.
$keys
[
'bundle'
]
=
$entity_type_id
==
'menu_link_content'
?
'menu_name'
:
$keys
[
'bundle'
];
$keys
[
'bundle'
]
=
$entity_type_id
==
=
'menu_link_content'
?
'menu_name'
:
$keys
[
'bundle'
];
$query
=
$this
->
entityTypeManager
->
getStorage
(
$entity_type_id
)
->
getQuery
();
$query
=
$this
->
entityTypeManager
->
getStorage
(
$entity_type_id
)
->
getQuery
();
if
(
!
$this
->
entityHelper
->
entityTypeIsAtomic
(
$entity_type_id
))
{
if
(
!
$this
->
entityHelper
->
entityTypeIsAtomic
(
$entity_type_id
))
{
...
@@ -622,7 +622,7 @@ class Simplesitemap {
...
@@ -622,7 +622,7 @@ class Simplesitemap {
// todo: log error.
// todo: log error.
return
$this
;
return
$this
;
}
}
if
(
$path
[
0
]
!=
'/'
)
{
if
(
$path
[
0
]
!=
=
'/'
)
{
// todo: log error.
// todo: log error.
return
$this
;
return
$this
;
}
}
...
...
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