function xmlsitemap_link_bundle_settings_save in XML sitemap 8
Same name and namespace in other branches
- 6.2 xmlsitemap.module \xmlsitemap_link_bundle_settings_save()
- 7.2 xmlsitemap.module \xmlsitemap_link_bundle_settings_save()
- 2.x xmlsitemap.module \xmlsitemap_link_bundle_settings_save()
Saves xmlsitemap settings for a specific bundle.
Parameters
string $entity: Entity type id.
string $bundle: Bundle id.
array $settings: Settings to be saved.
bool $update_links: Update bundle links after settings are saved.
10 calls to xmlsitemap_link_bundle_settings_save()
- MetatagNoIndexTest::setUp in tests/
src/ Kernel/ MetatagNoIndexTest.php - XmlSitemapLinkBundleSettingsForm::submitForm in src/
Form/ XmlSitemapLinkBundleSettingsForm.php - Form submission handler.
- XmlSitemapNodeFunctionalTest::setUp in tests/
src/ Functional/ XmlSitemapNodeFunctionalTest.php - XmlSitemapNodeFunctionalTest::testTagsField in tests/
src/ Functional/ XmlSitemapNodeFunctionalTest.php - Test Tags Field.
- XmlSitemapRebuildTest::testUserLinksRebuild in tests/
src/ Functional/ XmlSitemapRebuildTest.php - Test if user links are included in sitemap after rebuild.
File
- ./
xmlsitemap.module, line 867 - xmlsitemap XML sitemap
Code
function xmlsitemap_link_bundle_settings_save($entity, $bundle, array $settings, $update_links = TRUE) {
if ($update_links) {
$old_settings = xmlsitemap_link_bundle_load($entity, $bundle);
if ($settings['status'] != $old_settings['status']) {
\Drupal::service('xmlsitemap.link_storage')
->updateMultiple([
'status' => $settings['status'],
], [
'type' => $entity,
'subtype' => $bundle,
'status_override' => 0,
]);
}
if ($settings['priority'] != $old_settings['priority']) {
\Drupal::service('xmlsitemap.link_storage')
->updateMultiple([
'priority' => $settings['priority'],
], [
'type' => $entity,
'subtype' => $bundle,
'priority_override' => 0,
]);
}
}
foreach ($settings as $key => $value) {
\Drupal::configFactory()
->getEditable("xmlsitemap.settings.{$entity}.{$bundle}")
->set($key, $value)
->save();
}
foreach (\Drupal::languageManager()
->getLanguages() as $lang) {
\Drupal::cache()
->delete('xmlsitemap:link_info:' . $lang
->getId());
}
xmlsitemap_get_link_info(NULL, TRUE);
}