class PhpTransliteration
Same name in this branch
- 9 core/lib/Drupal/Component/Transliteration/PhpTransliteration.php \Drupal\Component\Transliteration\PhpTransliteration
Same name in other branches
- 8.9.x core/lib/Drupal/Core/Transliteration/PhpTransliteration.php \Drupal\Core\Transliteration\PhpTransliteration
- 8.9.x core/lib/Drupal/Component/Transliteration/PhpTransliteration.php \Drupal\Component\Transliteration\PhpTransliteration
- 10 core/lib/Drupal/Core/Transliteration/PhpTransliteration.php \Drupal\Core\Transliteration\PhpTransliteration
- 10 core/lib/Drupal/Component/Transliteration/PhpTransliteration.php \Drupal\Component\Transliteration\PhpTransliteration
- 11.x core/lib/Drupal/Core/Transliteration/PhpTransliteration.php \Drupal\Core\Transliteration\PhpTransliteration
- 11.x core/lib/Drupal/Component/Transliteration/PhpTransliteration.php \Drupal\Component\Transliteration\PhpTransliteration
Enhances PhpTransliteration with an alter hook.
Hierarchy
- class \Drupal\Component\Transliteration\PhpTransliteration implements \Drupal\Component\Transliteration\TransliterationInterface
- class \Drupal\Core\Transliteration\PhpTransliteration extends \Drupal\Component\Transliteration\PhpTransliteration
Expanded class hierarchy of PhpTransliteration
See also
hook_transliteration_overrides_alter()
Related topics
1 file declares its use of PhpTransliteration
- PhpTransliterationTest.php in core/
tests/ Drupal/ Tests/ Core/ Transliteration/ PhpTransliterationTest.php
1 string reference to 'PhpTransliteration'
- core.services.yml in core/
core.services.yml - core/core.services.yml
1 service uses PhpTransliteration
File
-
core/
lib/ Drupal/ Core/ Transliteration/ PhpTransliteration.php, line 14
Namespace
Drupal\Core\TransliterationView source
class PhpTransliteration extends BaseTransliteration {
/**
* The module handler to execute the transliteration_overrides alter hook.
*
* @var \Drupal\Core\Extension\ModuleHandlerInterface
*/
protected $moduleHandler;
/**
* Constructs a PhpTransliteration object.
*
* @param string $data_directory
* The directory where data files reside. If NULL, defaults to subdirectory
* 'data' underneath the directory where the class's PHP file resides.
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The module handler to execute the transliteration_overrides alter hook.
*/
public function __construct($data_directory, ModuleHandlerInterface $module_handler) {
parent::__construct($data_directory);
$this->moduleHandler = $module_handler;
}
/**
* Overrides \Drupal\Component\Transliteration\PhpTransliteration::readLanguageOverrides().
*
* Allows modules to alter the language-specific $overrides array by invoking
* hook_transliteration_overrides_alter().
*/
protected function readLanguageOverrides($langcode) {
parent::readLanguageOverrides($langcode);
// Let modules alter the language-specific overrides.
$this->moduleHandler
->alter('transliteration_overrides', $this->languageOverrides[$langcode], $langcode);
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title |
---|---|---|---|---|
PhpTransliteration::$dataDirectory | protected | property | Directory where data for transliteration resides. | |
PhpTransliteration::$fixTransliterateForRemoveDiacritics | protected | property | Special characters for ::removeDiacritics(). | |
PhpTransliteration::$genericMap | protected | property | Non-language-specific transliteration tables. | |
PhpTransliteration::$languageOverrides | protected | property | Associative array of language-specific character transliteration tables. | |
PhpTransliteration::$moduleHandler | protected | property | The module handler to execute the transliteration_overrides alter hook. | |
PhpTransliteration::lookupReplacement | protected | function | Look up the generic replacement for a UTF-8 character code. | |
PhpTransliteration::ordUTF8 | protected static | function | Finds the character code for a UTF-8 character: like ord() but for UTF-8. | |
PhpTransliteration::readGenericData | protected | function | Reads in generic transliteration data for a bank of characters. | |
PhpTransliteration::readLanguageOverrides | protected | function | Overrides \Drupal\Component\Transliteration\PhpTransliteration::readLanguageOverrides(). | Overrides PhpTransliteration::readLanguageOverrides |
PhpTransliteration::removeDiacritics | public | function | Removes diacritics (accents) from certain letters. | Overrides TransliterationInterface::removeDiacritics |
PhpTransliteration::replace | protected | function | Replaces a single Unicode character using the transliteration database. | |
PhpTransliteration::transliterate | public | function | Transliterates text from Unicode to US-ASCII. | Overrides TransliterationInterface::transliterate |
PhpTransliteration::__construct | public | function | Constructs a PhpTransliteration object. | Overrides PhpTransliteration::__construct |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.