Commit 54da0089 authored by andrei.dincu's avatar andrei.dincu

Issue #2249723 by andrei.dincu: Few changes in xmlsitemap_help() hook

parent 3c8981b0
......@@ -13,7 +13,7 @@ use Drupal\Core\Language\LanguageInterface;
*/
function xmlsitemap_requirements($phase) {
$requirements = array();
$t = 't()';
$t = 't';
// Check that required PHP extensions are enabled.
// Note: Drupal 7 already requires the 'xml' extension.
......
......@@ -9,6 +9,8 @@
* Main file for the xmlsitemap module.
*/
use Drupal\Component\Utility\Crypt;
use Drupal\Core\Session\UserSession;
use Symfony\Component\HttpFoundation\Request;
/**
* The maximum number of links in one sitemap chunk file.
......@@ -86,11 +88,11 @@ function xmlsitemap_hook_info() {
/**
* Implements hook_help().
*/
function xmlsitemap_help($path, $arg) {
function xmlsitemap_help($path, Request $request) {
$output = '';
switch ($path) {
case 'admin/help/xmlsitemap':
case 'help.page.xmlsitemap':
case 'admin/config/search/xmlsitemap/settings/%/%/%':
case 'admin/config/search/xmlsitemap/edit/%':
case 'admin/config/search/xmlsitemap/delete/%':
......@@ -103,12 +105,11 @@ function xmlsitemap_help($path, $arg) {
$output .= '<p>' . t("This action rebuilds your site's XML sitemap and regenerates the cached files, and may be a lengthy process. If you just installed XML sitemap, this can be helpful to import all your site's content into the sitemap. Otherwise, this should only be used in emergencies.") . '</p>';
}
if (arg(0) == 'admin' && strpos($path, 'xmlsitemap') !== FALSE && user_access('administer xmlsitemap')) {
$currentUser = \Drupal::currentUser();
if (arg(0) == 'admin' && strpos($path, 'xmlsitemap') !== FALSE && $currentUser->hasPermission('administer xmlsitemap')) {
module_load_include('inc', 'xmlsitemap');
if ($arg[1] == 'config') {
// Alert the user to any potential problems detected by hook_requirements.
xmlsitemap_check_status();
}
// Alert the user to any potential problems detected by hook_requirements.
xmlsitemap_check_status();
$output .= _xmlsitemap_get_blurb();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment