You are here

public function Simplesitemap::getEntityInstanceSettings in Simple XML sitemap 8.2

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

Gets sitemap settings for an entity instance which overrides the sitemap settings of its bundle, or bundle settings, if they are not overridden.

Parameters

string $entity_type_id:

int $id:

Return value

array|false

File

src/Simplesitemap.php, line 546

Class

Simplesitemap
Class Simplesitemap @package Drupal\simple_sitemap

Namespace

Drupal\simple_sitemap

Code

public function getEntityInstanceSettings($entity_type_id, $id) {
  $results = $this->db
    ->select('simple_sitemap_entity_overrides', 'o')
    ->fields('o', [
    'inclusion_settings',
  ])
    ->condition('o.entity_type', $entity_type_id)
    ->condition('o.entity_id', $id)
    ->execute()
    ->fetchField();
  if (!empty($results)) {
    return unserialize($results);
  }
  else {
    $entity = $this->entityTypeManager
      ->getStorage($entity_type_id)
      ->load($id);
    return $this
      ->getBundleSettings($entity_type_id, $this->entityHelper
      ->getEntityInstanceBundleName($entity));
  }
}