You are here

static function Helpers::calendar_systems_get_calendar_system_name in Calendar Systems 8.2

Helper to determine the active calendar system

Parameters

null $language:

Return value

string

2 calls to Helpers::calendar_systems_get_calendar_system_name()
CalendarSystemsDateFormatter::format in src/Services/DateFormatter/CalendarSystemsDateFormatter.php
Formats a date, using a date type or a custom date format string.
Helpers::calendar_systems_get_calendar_instance in src/Helpers.php
Gets an instance of the calendar object for the selected calendar system acording to the settings or the passed arguments

File

src/Helpers.php, line 82
Contains \Drupal\calendar_systems.

Class

Helpers

Namespace

Drupal\calendar_systems

Code

static function calendar_systems_get_calendar_system_name($language = NULL) {

  // Load all available profiles:
  $profiles = self::calendar_systems_profiles();

  // Get site's current language:
  if (is_null($language)) {
    $language = self::calendar_systems_languages_active();
  }
  if (isset($profiles[$language])) {
    $calendar_system = $profiles[$language]['calendar_system'];
  }
  elseif (isset($profiles['default'])) {
    $calendar_system = $profiles['default']['calendar_system'];
  }
  if (empty($calendar_system)) {
    $calendar_system = 'default';
  }
  return $calendar_system;
}