You are here

function xmlsitemap_sitemap_load_multiple in XML sitemap 8

Same name and namespace in other branches
  1. 6.2 xmlsitemap.module \xmlsitemap_sitemap_load_multiple()
  2. 7.2 xmlsitemap.module \xmlsitemap_sitemap_load_multiple()
  3. 2.x xmlsitemap.module \xmlsitemap_sitemap_load_multiple()

Load multiple XML sitemaps from the database.

Parameters

array|bool $smids: An array of XML sitemap IDs, or FALSE to load all XML sitemaps.

array $conditions: An array of conditions in the form 'field' => $value.

Return value

\Drupal\xmlsitemap\XmlSitemapInterface[] An array of XML sitemap objects.

Related topics

4 calls to xmlsitemap_sitemap_load_multiple()
xmlsitemap_check_all_directories in ./xmlsitemap.module
Check all directories.
xmlsitemap_engines_submit_engines in xmlsitemap_engines/xmlsitemap_engines.module
Submit the sitemaps to all the specified search engines.
xmlsitemap_sitemap_delete_multiple in ./xmlsitemap.module
Delete multiple XML sitemaps.
xmlsitemap_sitemap_load in ./xmlsitemap.module
Load an XML sitemap array from the database.

File

./xmlsitemap.module, line 322
xmlsitemap XML sitemap

Code

function xmlsitemap_sitemap_load_multiple($smids = [], array $conditions = []) {
  if ($smids !== FALSE) {
    $conditions['smid'] = $smids;
  }
  else {
    $conditions['smid'] = NULL;
  }
  $storage = Drupal::entityTypeManager()
    ->getStorage('xmlsitemap');

  /** @var \Drupal\xmlsitemap\XmlSitemapInterface[] $sitemaps */
  $sitemaps = $storage
    ->loadMultiple($conditions['smid']);
  if (count($sitemaps) <= 0) {
    return [];
  }
  return $sitemaps;
}