You are here

public function EntityManager::enableEntityType in Simple XML sitemap 4.x

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

\Drupal\simple_sitemap\Manager\EntityManager

File

src/Manager/EntityManager.php, line 94

Class

EntityManager
Class EntityManager

Namespace

Drupal\simple_sitemap\Manager

Code

public function enableEntityType(string $entity_type_id) : EntityManager {
  $enabled_entity_types = $this->settings
    ->get('enabled_entity_types');
  if (!in_array($entity_type_id, $enabled_entity_types, TRUE)) {
    $enabled_entity_types[] = $entity_type_id;
    $this->settings
      ->save('enabled_entity_types', $enabled_entity_types);
  }
  return $this;
}