You are here

function xmlsitemap_link_bundle_enable in XML sitemap 8

Same name and namespace in other branches
  1. 2.x xmlsitemap.module \xmlsitemap_link_bundle_enable()

Link bundle enable.

Enable an entity bundle and create specific xmlsitemap settings config object.

Parameters

string $entity_type_id: Entity type id.

string $bundle_id: Bundle id.

Return value

bool Returns TRUE if operation was successful.

8 calls to xmlsitemap_link_bundle_enable()
MetatagNoIndexTest::setUp in tests/src/Kernel/MetatagNoIndexTest.php
XmlSitemapEntitiesSettingsForm::submitForm in src/Form/XmlSitemapEntitiesSettingsForm.php
Form submission handler.
XmlSitemapEntityFunctionalTest::testEntityLinkBundleSettingsForm in tests/src/Functional/XmlSitemapEntityFunctionalTest.php
Test Entity Link Bundle Settings Form.
XmlSitemapEntityFunctionalTest::testUserCannotViewEntity in tests/src/Functional/XmlSitemapEntityFunctionalTest.php
Test User Cannot View Entity.
XmlSitemapMenuFunctionalTest::setUp in tests/src/Functional/XmlSitemapMenuFunctionalTest.php

... See full list

File

./xmlsitemap.module, line 2647
xmlsitemap XML sitemap

Code

function xmlsitemap_link_bundle_enable($entity_type_id, $bundle_id) {
  if (\Drupal::config("xmlsitemap.settings.{$entity_type_id}.{$bundle_id}")
    ->isNew()) {
    $settings = [
      'status' => XMLSITEMAP_STATUS_DEFAULT,
      'priority' => XMLSITEMAP_PRIORITY_DEFAULT,
      'changefreq' => 0,
    ];
    xmlsitemap_link_bundle_settings_save($entity_type_id, $bundle_id, $settings);
  }
  return TRUE;
}