simple_sitemap.drush.inc 616 Bytes
Newer Older
1
<?php
gbyte.co's avatar
gbyte.co committed
2

3 4 5 6 7 8 9 10
/**
 * @file
 * Drush integration.
 */

/**
 * Implements hook_drush_command().
 */
gbyte.co's avatar
gbyte.co committed
11
function simple_sitemap_drush_command() {
12
  $items['simple_sitemap-generate'] = [
13
    'description' => 'Regenerate XML sitemaps for all languages according to the module settings.',
gbyte.co's avatar
gbyte.co committed
14
    'callback' => 'drush_simple_sitemap_generate',
15 16
    'drupal dependencies' => ['simple_sitemap'],
  ];
17 18 19 20 21 22 23 24
  return $items;
}

/**
 * Callback function for hook_drush_command().
 *
 * Regenerate sitemap for all languages.
 */
gbyte.co's avatar
gbyte.co committed
25
function drush_simple_sitemap_generate() {
gbyte.co's avatar
gbyte.co committed
26
  \Drupal::service('simple_sitemap.generator')->generateSitemap('drush');
27
}