You are here

public function SimpleSitemapViews::getSitemapSettings in Simple XML sitemap 4.x

Same name and namespace in other branches
  1. 8.3 modules/simple_sitemap_views/src/SimpleSitemapViews.php \Drupal\simple_sitemap_views\SimpleSitemapViews::getSitemapSettings()

Gets the sitemap settings for view display.

Parameters

\Drupal\views\ViewExecutable $view: A view executable instance.

string $variant: The name of the sitemap variant.

string|null $display_id: The display id. If empty uses the current display.

Return value

array|null The sitemap settings if the display is indexed, NULL otherwise.

3 calls to SimpleSitemapViews::getSitemapSettings()
SimpleSitemapViews::addArgumentsToIndexByVariant in modules/simple_sitemap_views/src/SimpleSitemapViews.php
Adds view arguments to the index by the sitemap variant.
SimpleSitemapViews::getIndexableArguments in modules/simple_sitemap_views/src/SimpleSitemapViews.php
Gets the indexable arguments for view display.
SimpleSitemapViews::getIndexableVariants in modules/simple_sitemap_views/src/SimpleSitemapViews.php
Returns an array of indexable sitemap variants for view display.

File

modules/simple_sitemap_views/src/SimpleSitemapViews.php, line 171

Class

SimpleSitemapViews
Class to manage sitemap data for views.

Namespace

Drupal\simple_sitemap_views

Code

public function getSitemapSettings(ViewExecutable $view, string $variant, ?string $display_id = NULL) : ?array {
  $extender = $this
    ->getDisplayExtender($view, $display_id);

  // Retrieve the sitemap settings from the extender.
  if ($extender && $extender
    ->hasSitemapSettings()) {
    $settings = $extender
      ->getSitemapSettings($variant);
    if ($settings['index']) {
      return $settings;
    }
  }
  return NULL;
}