constPATH_DOES_NOT_EXIST_OR_NO_ACCESS_MESSAGE="The path @path has been omitted from the XML sitemap as it either does not exist, or it is not accessible to anonymous users.";
constPROCESSING_PATH_MESSAGE='Processing path #@current out of @max: @path';
constREGENERATION_FINISHED_MESSAGE="The <a href='@url' target='_blank'>XML sitemap</a> has been regenerated for all languages.";
constREGENERATION_FINISHED_MESSAGE="The <a href='@url' target='_blank'>XML sitemap</a> has been regenerated for all languages.";
protected$sitemapGenerator;
protected$languageManager;
...
...
@@ -35,6 +36,7 @@ class BatchUrlGenerator {
/**
* BatchUrlGenerator constructor.
*
* @param $sitemap_generator
* @param $language_manager
* @param $entity_type_manager
...
...
@@ -50,7 +52,8 @@ class BatchUrlGenerator {
$entity_query,
$logger
){
$this->sitemapGenerator=$sitemap_generator;//todo using only one method, maybe make method static instead?
// Todo using only one method, maybe make method static instead?
case'menu_link_content':// Loading url object for menu links.
if(!$entity->isEnabled())
// Loading url object for menu links.
case'menu_link_content':
if(!$entity->isEnabled()){
continue;
}
$url_object=$entity->getUrlObject();
break;
default:// Loading url object for other entities.
$url_object=$entity->toUrl();//todo: file entity type does not have a canonical url and breaks generation, hopefully fixed in https://www.drupal.org/node/2402533
// Loading url object for other entities.
default:
// todo: file entity type does not have a canonical url and breaks generation, hopefully fixed in https://www.drupal.org/node/2402533
$url_object=$entity->toUrl();
}
// Do not include external paths.
if(!$url_object->isRouted())
if(!$url_object->isRouted()){
continue;
}
// Do not include paths inaccessible to anonymous users.
if(!$url_object->access($this->anonUser))
if(!$url_object->access($this->anonUser)){
continue;
}
// Do not include paths that have been already indexed.
if(!$this->pathValidator->isValid($custom_path['path'])){//todo: Change to different function, as this also checks if current user has access. The user however varies depending if process was started from the web interface or via cron/drush. Use getUrlIfValidWithoutAccessCheck()?
// todo: Change to different function, as this also checks if current user has access. The user however varies depending if process was started from the web interface or via cron/drush. Use getUrlIfValidWithoutAccessCheck()?
0=>$this->entityCategory=='instance'?$this->t('Do not index this @bundle entity',['@bundle'=>$bundle_name]):$this->t('Do not index entities of this type'),
1=>$this->entityCategory=='instance'?$this->t('Index this @bundle entity',['@bundle'=>$bundle_name]):$this->t('Index entities of this type'),
||strpos($link_config['path'],'//')!==FALSE){// Path validator does not see a double slash as an error. Catching this to prevent breaking path generation.
// Path validator does not see a double slash as an error. Catching this to prevent breaking path generation.
||strpos($link_config['path'],'//')!==FALSE){
$form_state->setErrorByName('',$this->t("<strong>Line @line</strong>: The path <em>@path</em> does not exist.",$placeholders));
}
...
...
@@ -101,7 +103,7 @@ class SimplesitemapCustomLinksForm extends SimplesitemapFormBase {
// Remove empty values and whitespaces from array.