class PhpTransliteration in Drupal 9
Same name in this branch
- 9 core/lib/Drupal/Core/Transliteration/PhpTransliteration.php \Drupal\Core\Transliteration\PhpTransliteration
- 9 core/lib/Drupal/Component/Transliteration/PhpTransliteration.php \Drupal\Component\Transliteration\PhpTransliteration
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Transliteration/PhpTransliteration.php \Drupal\Core\Transliteration\PhpTransliteration
Enhances PhpTransliteration with an alter hook.
Hierarchy
- class \Drupal\Component\Transliteration\PhpTransliteration implements TransliterationInterface
- class \Drupal\Core\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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PhpTransliteration:: |
protected | property | Directory where data for transliteration resides. | |
PhpTransliteration:: |
protected | property | Special characters for ::removeDiacritics(). | |
PhpTransliteration:: |
protected | property | Non-language-specific transliteration tables. | |
PhpTransliteration:: |
protected | property | Associative array of language-specific character transliteration tables. | |
PhpTransliteration:: |
protected | property | The module handler to execute the transliteration_overrides alter hook. | |
PhpTransliteration:: |
protected | function | Look up the generic replacement for a UTF-8 character code. | |
PhpTransliteration:: |
protected static | function | Finds the character code for a UTF-8 character: like ord() but for UTF-8. | |
PhpTransliteration:: |
protected | function | Reads in generic transliteration data for a bank of characters. | |
PhpTransliteration:: |
protected | function |
Overrides \Drupal\Component\Transliteration\PhpTransliteration::readLanguageOverrides(). Overrides PhpTransliteration:: |
|
PhpTransliteration:: |
public | function |
Removes diacritics (accents) from certain letters. Overrides TransliterationInterface:: |
|
PhpTransliteration:: |
protected | function | Replaces a single Unicode character using the transliteration database. | |
PhpTransliteration:: |
public | function |
Transliterates text from Unicode to US-ASCII. Overrides TransliterationInterface:: |
|
PhpTransliteration:: |
public | function |
Constructs a PhpTransliteration object. Overrides PhpTransliteration:: |