You are here

public function FormHelper::getVariantSelectValuesDefault in Simple XML sitemap 8.3

Returns correct default value for variant select list.

If only one variant is available, return it, otherwise check if a default variant is provided and return it.

Parameters

string|null $default_value: Actual default value from the database.

Return value

string|null Value to be set on form.

File

src/Form/FormHelper.php, line 518

Class

FormHelper
Class FormHelper @package Drupal\simple_sitemap\Form

Namespace

Drupal\simple_sitemap\Form

Code

public function getVariantSelectValuesDefault($default_value) {
  $options = $this
    ->getVariantSelectValues();
  return NULL === $default_value ? 1 === count($options) ? array_keys($options)[0] : (!empty($default = $this->generator
    ->getSetting('default_variant')) ? $default : $default_value) : $default_value;
}