You are here

public function Simplesitemap::enableEntityType in Simple XML sitemap 8.2

Same name and namespace in other branches
  1. 8.3 src/Simplesitemap.php \Drupal\simple_sitemap\Simplesitemap::enableEntityType()

Enables sitemap support for an entity type. Enabled entity types show sitemap settings on their bundle setting forms. If an enabled entity type features bundles (e.g. 'node'), it needs to be set up with setBundleSettings() as well.

Parameters

string $entity_type_id: Entity type id like 'node'.

Return value

$this

File

src/Simplesitemap.php, line 315

Class

Simplesitemap
Class Simplesitemap @package Drupal\simple_sitemap

Namespace

Drupal\simple_sitemap

Code

public function enableEntityType($entity_type_id) {
  $enabled_entity_types = $this
    ->getSetting('enabled_entity_types');
  if (!in_array($entity_type_id, $enabled_entity_types)) {
    $enabled_entity_types[] = $entity_type_id;
    $this
      ->saveSetting('enabled_entity_types', $enabled_entity_types);
  }
  return $this;
}