You are here

function hook_xmlsitemap_link_update in XML sitemap 8

Same name and namespace in other branches
  1. 6.2 xmlsitemap.api.php \hook_xmlsitemap_link_update()
  2. 7.2 xmlsitemap.api.php \hook_xmlsitemap_link_update()
  3. 2.x xmlsitemap.api.php \hook_xmlsitemap_link_update()

Inform modules that an XML sitemap link has been updated.

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

hook_xmlsitemap_link_insert()

1 invocation of hook_xmlsitemap_link_update()
XmlSitemapLinkStorage::save in src/XmlSitemapLinkStorage.php
Saves or updates a sitemap link.

File

./xmlsitemap.api.php, line 96
Hooks provided by the XML sitemap module.

Code

function hook_xmlsitemap_link_update(array $link, array $context) {
  \Drupal::database()
    ->update('mytable')
    ->fields([
    'link_type' => $link['type'],
    'link_id' => $link['id'],
    'link_status' => $link['status'],
  ])
    ->execute();
}