You are here

function xmlsitemap_link_bundle_load in XML sitemap 8

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

Loads link bundle info.

Parameters

string $entity: Entity type id.

string $bundle: Bundle info.

bool $load_bundle_info: If TRUE, loads bundle info.

Return value

array Info about a bundle.

7 calls to xmlsitemap_link_bundle_load()
XmlSitemapLinkStorage::create in src/XmlSitemapLinkStorage.php
Create a sitemap link from an entity.
xmlsitemap_add_form_link_options in ./xmlsitemap.module
Add a link's XML sitemap options to the link's form.
xmlsitemap_add_link_bundle_settings in ./xmlsitemap.module
Add the link type XML sitemap options to the link type's form.
xmlsitemap_get_link_info in ./xmlsitemap.module
Returns information about supported sitemap link types.
xmlsitemap_get_link_type_enabled_bundles in ./xmlsitemap.module
Returns enabled bundles of an entity type.

... See full list

File

./xmlsitemap.module, line 930
xmlsitemap XML sitemap

Code

function xmlsitemap_link_bundle_load($entity, $bundle, $load_bundle_info = TRUE) {
  $info = [
    'entity' => $entity,
    'bundle' => $bundle,
  ];
  if ($load_bundle_info) {
    $entity_info = xmlsitemap_get_link_info($entity);
    if (isset($entity_info['bundles'][$bundle])) {
      $info['info'] = $entity_info['bundles'][$bundle];
    }
  }
  $bundle_settings = \Drupal::config("xmlsitemap.settings.{$entity}.{$bundle}")
    ->get();
  if ($bundle_settings) {
    $info += $bundle_settings;
  }
  $info += [
    'status' => XMLSITEMAP_STATUS_DEFAULT,
    'priority' => XMLSITEMAP_PRIORITY_DEFAULT,
    'changefreq' => 0,
  ];
  return $info;
}