You are here

function xmlsitemap_link_bundle_delete in XML sitemap 8

Same name and namespace in other branches
  1. 6.2 xmlsitemap.module \xmlsitemap_link_bundle_delete()
  2. 7.2 xmlsitemap.module \xmlsitemap_link_bundle_delete()
  3. 2.x xmlsitemap.module \xmlsitemap_link_bundle_delete()

Deletes all links of a specific bundle.

Parameters

string $entity: Entity type id.

string $bundle: Bundle id.

bool $delete_links: If TRUE, deletes bundle links from {xmlsitemap} table.

4 calls to xmlsitemap_link_bundle_delete()
XmlSitemapEntitiesSettingsForm::submitForm in src/Form/XmlSitemapEntitiesSettingsForm.php
Form submission handler.
XmlSitemapMenuFunctionalTest::tearDown in tests/src/Functional/XmlSitemapMenuFunctionalTest.php
xmlsitemap_entity_bundle_delete in ./xmlsitemap.module
Implements hook_entity_bundle_delete().
xmlsitemap_uninstall in ./xmlsitemap.install
Implements hook_uninstall().

File

./xmlsitemap.module, line 963
xmlsitemap XML sitemap

Code

function xmlsitemap_link_bundle_delete($entity, $bundle, $delete_links = TRUE) {
  \Drupal::configFactory()
    ->getEditable("xmlsitemap.settings.{$entity}.{$bundle}")
    ->delete();
  if ($delete_links) {
    \Drupal::service('xmlsitemap.link_storage')
      ->deleteMultiple([
      'type' => $entity,
      'subtype' => $bundle,
    ]);
  }
  xmlsitemap_get_link_info(NULL, TRUE);
}