You are here

public function SimpleSitemapViews::getDisplayExtender in Simple XML sitemap 8.3

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

Gets the display extender.

Parameters

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

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

Return value

\Drupal\simple_sitemap_views\Plugin\views\display_extender\SimpleSitemapDisplayExtender|null The display extender.

1 call to SimpleSitemapViews::getDisplayExtender()
SimpleSitemapViews::getSitemapSettings in modules/simple_sitemap_views/src/SimpleSitemapViews.php
Gets the sitemap settings for view display.

File

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

Class

SimpleSitemapViews
Class to manage sitemap data for views.

Namespace

Drupal\simple_sitemap_views

Code

public function getDisplayExtender(ViewExecutable $view, $display_id = NULL) {

  // Ensure the display was correctly set.
  if (!$view
    ->setDisplay($display_id)) {
    return NULL;
  }
  $extenders = $view->display_handler
    ->getExtenders();
  $extender = isset($extenders[self::PLUGIN_ID]) ? $extenders[self::PLUGIN_ID] : NULL;
  if ($extender instanceof SimpleSitemapDisplayExtender) {
    return $extender;
  }
  return NULL;
}