You are here

public function XmlSitemapLinkStorage::delete in XML sitemap 8

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

Delete a specific sitemap link from the database.

If a visible sitemap link was deleted, this will automatically set the regenerate needed flag.

Parameters

string $entity_type: A string with the entity type.

string $entity_id: Entity ID to be deleted.

string $langcode: (optional) The language code for the link that should be deleted. If omitted, links for that entity will be removed in all languages.

Return value

int The number of links that were deleted.

Overrides XmlSitemapLinkStorageInterface::delete

File

src/XmlSitemapLinkStorage.php, line 271

Class

XmlSitemapLinkStorage
XmlSitemap link storage service class.

Namespace

Drupal\xmlsitemap

Code

public function delete($entity_type, $entity_id, $langcode = NULL) {
  $conditions = [
    'type' => $entity_type,
    'id' => $entity_id,
  ];
  if ($langcode) {
    $conditions['language'] = $langcode;
  }
  return $this
    ->deleteMultiple($conditions);
}