function replace_with_equivalent_module_class in Persian Date for Drupal 8 8
Same name and namespace in other branches
- 8.4 persian_date.module \replace_with_equivalent_module_class()
1 call to replace_with_equivalent_module_class()
- persian_date_element_info_alter in ./
persian_date.module - Replace form elements with persian ones
File
- ./
persian_date.module, line 71 - Contains persian_date.module.
Code
function replace_with_equivalent_module_class($string) {
$replacements = [
\Drupal\Core\Datetime\Element\Datelist::class => \Drupal\persian_date\Element\PersianDateList::class,
\Drupal\Core\Render\Element\Date::class => \Drupal\persian_date\Element\PersianDate::class,
\Drupal\Core\Datetime\Element\Datetime::class => \Drupal\persian_date\Element\PersianDateTime::class,
];
foreach ($replacements as $search => $replacement) {
$string = str_replace($search, $replacement, $string);
}
return $string;
}