class PersianLanguageDiscovery in Persian Date for Drupal 8 8.4
Same name and namespace in other branches
- 8 src/PersianLanguageDiscovery.php \Drupal\persian_date\PersianLanguageDiscovery
Hierarchy
- class \Drupal\persian_date\PersianLanguageDiscovery
Expanded class hierarchy of PersianLanguageDiscovery
8 files declare their use of PersianLanguageDiscovery
- BlockContentTranslationHandler.php in src/
TranslationHandler/ BlockContentTranslationHandler.php - CommentTranslationHandler.php in src/
TranslationHandler/ CommentTranslationHandler.php - ContentTranslationHandler.php in src/
TranslationHandler/ ContentTranslationHandler.php - NodeTranslationHandler.php in src/
TranslationHandler/ NodeTranslationHandler.php - PersianDateFormatter.php in src/
Service/ Formatter/ PersianDateFormatter.php
File
- src/
PersianLanguageDiscovery.php, line 12
Namespace
Drupal\persian_dateView source
class PersianLanguageDiscovery {
private static $isPersian = null;
/**
* @return bool
*/
public static function isPersian() {
if (self::$isPersian === null) {
// only convert farsi on multi lingual sites
$isMultiLingual = count(\Drupal::languageManager()
->getLanguages()) > 1;
if ($isMultiLingual) {
$language = \Drupal::languageManager()
->getCurrentLanguage()
->getId();
if ($language !== 'fa') {
self::$isPersian = false;
}
else {
self::$isPersian = true;
}
}
else {
self::$isPersian = true;
}
}
return self::$isPersian;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PersianLanguageDiscovery:: |
private static | property | ||
PersianLanguageDiscovery:: |
public static | function |