simple_sitemap.drush.inc 642 Bytes
Newer Older
1 2 3 4 5 6 7 8 9
<?php
/**
 * @file
 * Drush integration.
 */

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

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