You are here

public function EntityUrlGeneratorBase::generate in Simple XML sitemap 4.x

Same name and namespace in other branches
  1. 8.3 src/Plugin/simple_sitemap/UrlGenerator/EntityUrlGeneratorBase.php \Drupal\simple_sitemap\Plugin\simple_sitemap\UrlGenerator\EntityUrlGeneratorBase::generate()

Parameters

mixed $data_set:

Return value

array

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

Overrides UrlGeneratorBase::generate

1 method overrides EntityUrlGeneratorBase::generate()
EntityUrlGenerator::generate in src/Plugin/simple_sitemap/UrlGenerator/EntityUrlGenerator.php
@inheritdoc

File

src/Plugin/simple_sitemap/UrlGenerator/EntityUrlGeneratorBase.php, line 200

Class

EntityUrlGeneratorBase
Class EntityUrlGeneratorBase

Namespace

Drupal\simple_sitemap\Plugin\simple_sitemap\UrlGenerator

Code

public function generate($data_set) : array {
  $path_data = $this
    ->processDataSet($data_set);
  if (isset($path_data['url']) && $path_data['url'] instanceof Url) {
    $url_object = $path_data['url'];
    unset($path_data['url']);
    return $this
      ->getUrlVariants($path_data, $url_object);
  }
  return FALSE !== $path_data ? [
    $path_data,
  ] : [];

  // todo: May not want to return array here.
}