You are here

public function Simplesitemap::removeEntityInstanceSettings in Simple XML sitemap 8.3

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

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

Parameters

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

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

Return value

$this

3 calls to Simplesitemap::removeEntityInstanceSettings()
Simplesitemap::removeBundleSettings in src/Simplesitemap.php
Removes settings for bundle or a non-bundle entity types. This is done for the currently set variants.
Simplesitemap::setBundleSettings in src/Simplesitemap.php
Sets settings for bundle or non-bundle entity types. This is done for the currently set variant.
Simplesitemap::setEntityInstanceSettings in src/Simplesitemap.php
Overrides sitemap settings for a single entity for the currently set variants.

File

src/Simplesitemap.php, line 800

Class

Simplesitemap
Class Simplesitemap @package Drupal\simple_sitemap

Namespace

Drupal\simple_sitemap

Code

public function removeEntityInstanceSettings($entity_type_id = NULL, $entity_ids = NULL) {
  if (empty($variants = $this
    ->getVariants(FALSE))) {
    return $this;
  }
  $query = $this->db
    ->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;
}