You are here

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

Removes sitemap settings for entities that override bundle settings. This is done for the currently set variants.

@todo Pass entity object instead of id and bundle.

Parameters

string|null $entity_type_id: Limits the removal to a certain entity type.

string|array|null $entity_ids: Limits the removal to entities with certain IDs.

Return value

\Drupal\simple_sitemap\Manager\EntityManager

3 calls to EntityManager::removeEntityInstanceSettings()
EntityManager::removeBundleSettings in src/Manager/EntityManager.php
Removes settings for bundle or a non-bundle entity types. This is done for the currently set variants.
EntityManager::setBundleSettings in src/Manager/EntityManager.php
Sets settings for bundle or non-bundle entity types. This is done for the currently set variant. Note that this method takes only the first set variant into account. See todo.
EntityManager::setEntityInstanceSettings in src/Manager/EntityManager.php
Overrides sitemap settings for a single entity for the currently set variants.

File

src/Manager/EntityManager.php, line 447

Class

EntityManager
Class EntityManager

Namespace

Drupal\simple_sitemap\Manager

Code

public function removeEntityInstanceSettings(?string $entity_type_id = NULL, $entity_ids = NULL) : EntityManager {
  if (empty($variants = $this
    ->getVariants(FALSE))) {
    return $this;
  }
  $query = $this->database
    ->delete('simple_sitemap_entity_overrides')
    ->condition('type', $variants, 'IN');
  if (NULL !== $entity_type_id) {
    $query
      ->condition('entity_type', $entity_type_id);
    if (NULL !== $entity_ids) {
      $query
        ->condition('entity_id', (array) $entity_ids, 'IN');
    }
  }
  $query
    ->execute();
  return $this;
}