CustomLinkGenerator.php 757 Bytes
Newer Older
1 2 3
<?php
/**
 * @file
gbyte.co's avatar
gbyte.co committed
4
 * Contains \Drupal\simple_sitemap\LinkGenerators\CustomLinkGenerator.
5
 *
6
 * Generates custom sitemap paths provided by the user.
7 8
 */

gbyte.co's avatar
gbyte.co committed
9
namespace Drupal\simple_sitemap;
10 11 12 13

/**
 * CustomLinkGenerator class.
 */
gbyte.co's avatar
gbyte.co committed
14
class CustomLinkGenerator {
15

16 17 18 19
  /**
   * Returns an array of all urls of the custom paths.
   *
   * @param array $custom_paths
20
   *
21
   * @return array $urls
22
   *
23
   */
24
  public function getCustomPaths($custom_paths) {
25
    $paths = array();
26
    foreach($custom_paths as $i => $custom_path) {
gbyte.co's avatar
gbyte.co committed
27 28 29
      $paths[$i]['path'] = $custom_path['path'];
      $paths[$i]['priority'] = isset($custom_path['priority']) ? $custom_path['priority'] : NULL;
      $paths[$i]['lastmod'] = NULL; //todo: implement lastmod
30
    }
31
    return $paths;
32 33
  }
}