You are here

function User::get_paths in Simple XML sitemap 8

Returns an array of all urls and their data of a bundle.

@abstract

Parameters

string $bundle: Machine name of the bundle, eg. 'page'.

Return value

array $paths A numeric array of Drupal internal path data sets containing the internal path, url objects for every language (optional), lastmod (optional) and priority (optional):

array( 0 => array( 'path_data' => array( 'path' => '/relative/path/to/drupal/page', 'urls' => array( //optional 'en' => Drupal\Core\Url, 'de' => Drupal\Core\Url, ), ), 'priority' => 0.5 // optional 'lastmod' => '1234567890' // optional: content changed unix date ), )

Overrides LinkGeneratorBase::get_paths

File

src/Plugin/LinkGenerator/User.php, line 27
Contains \Drupal\simplesitemap\Plugin\LinkGenerator\User.

Class

User
User class.

Namespace

Drupal\simplesitemap\Plugin\LinkGenerator

Code

function get_paths($bundle) {
  $results = db_query("SELECT uid, changed FROM {users_field_data} WHERE status = 1")
    ->fetchAllAssoc('uid');
  $paths = array();
  foreach ($results as $id => $data) {
    $paths[$id]['path_data'] = $this
      ->get_multilang_urls_from_route("entity.user.canonical", array(
      'user' => $id,
    ));
    $paths[$id]['lastmod'] = $data->changed;
  }
  return $paths;
}