You are here

public function XmlSitemapLinkStorage::checkChangedLinks in XML sitemap 8

Same name and namespace in other branches
  1. 2.x src/XmlSitemapLinkStorage.php \Drupal\xmlsitemap\XmlSitemapLinkStorage::checkChangedLinks()

Check if there is a visible sitemap link given a certain set of conditions.


array $conditions: An array of values to match keyed by field.

array $updates: Updates to be made.

bool $flag: An optional boolean that if TRUE, will set the regenerate needed flag if there is a match. Defaults to FALSE.

Return value

bool TRUE if there is a visible link, or FALSE otherwise.

Overrides XmlSitemapLinkStorageInterface::checkChangedLinks

2 calls to XmlSitemapLinkStorage::checkChangedLinks()
XmlSitemapLinkStorage::deleteMultiple in src/XmlSitemapLinkStorage.php
Delete multiple sitemap links from the database.
XmlSitemapLinkStorage::updateMultiple in src/XmlSitemapLinkStorage.php
Perform a mass update of sitemap data.


src/XmlSitemapLinkStorage.php, line 247


XmlSitemap link storage service class.




public function checkChangedLinks(array $conditions = [], array $updates = [], $flag = FALSE) {

  // If we are changing status or access, check for negative current values.
  $conditions['status'] = !empty($updates['status']) && empty($conditions['status']) ? 0 : 1;
  $conditions['access'] = !empty($updates['access']) && empty($conditions['access']) ? 0 : 1;
  $query = $this->connection
  foreach ($conditions as $field => $value) {
    $operator = is_array($value) ? 'IN' : '=';
      ->condition($field, $value, $operator);
    ->range(0, 1);
  $changed = $query
  if ($changed && $flag) {
      ->set('xmlsitemap_regenerate_needed', TRUE);
  return $changed;