function hook_xmlsitemap_link_insert in XML sitemap 8
Same name and namespace in other branches
- 6.2 xmlsitemap.api.php \hook_xmlsitemap_link_insert()
- 7.2 xmlsitemap.api.php \hook_xmlsitemap_link_insert()
- 2.x xmlsitemap.api.php \hook_xmlsitemap_link_insert()
Inform modules that an XML sitemap link has been created.
Parameters
array $link: Associative array defining an XML sitemap link as passed into \Drupal\xmlsitemap\XmlSitemapLinkStorageInterface::save().
array $context: An optional context array containing data related to the link.
See also
1 invocation of hook_xmlsitemap_link_insert()
- XmlSitemapLinkStorage::save in src/
XmlSitemapLinkStorage.php - Saves or updates a sitemap link.
File
- ./
xmlsitemap.api.php, line 75 - Hooks provided by the XML sitemap module.
Code
function hook_xmlsitemap_link_insert(array $link, array $context) {
\Drupal::database()
->insert('mytable')
->fields([
'link_type' => $link['type'],
'link_id' => $link['id'],
'link_status' => $link['status'],
])
->execute();
}