You are here

function xmlsitemap_get_priority_options in XML sitemap 8

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

Get a list of priority options.

Parameters

string $default: Include a 'default' option.

bool $guides: Add helpful indicators for the highest, middle and lowest values.

Return value

array An array of options.

6 calls to xmlsitemap_get_priority_options()
XmlSitemapCustomAddForm::buildForm in xmlsitemap_custom/src/Form/XmlSitemapCustomAddForm.php
Form constructor.
XmlSitemapCustomEditForm::buildForm in xmlsitemap_custom/src/Form/XmlSitemapCustomEditForm.php
Form constructor.
xmlsitemap_add_form_entity_summary in ./xmlsitemap.module
Add a table summary for an entity and its bundles.
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.

... See full list

File

./xmlsitemap.module, line 2195
xmlsitemap XML sitemap

Code

function xmlsitemap_get_priority_options($default = NULL, $guides = TRUE) {
  $options = [];
  $priorities = [
    '1.0' => t('1.0'),
    '0.9' => t('0.9'),
    '0.8' => t('0.8'),
    '0.7' => t('0.7'),
    '0.6' => t('0.6'),
    '0.5' => t('0.5'),
    '0.4' => t('0.4'),
    '0.3' => t('0.3'),
    '0.2' => t('0.2'),
    '0.1' => t('0.1'),
    '0.0' => t('0.0'),
  ];
  if (isset($default)) {
    $default = number_format($default, 1);
    $options['default'] = t('Default (@value)', [
      '@value' => $priorities[$default],
    ]);
  }

  // Add the rest of the options.
  $options += $priorities;
  if ($guides) {
    $options['1.0'] .= ' ' . t('(highest)');
    $options['0.5'] .= ' ' . t('(normal)');
    $options['0.0'] .= ' ' . t('(lowest)');
  }
  return $options;
}