function LanguageHooks::tourTipsAlter
Implements hook_tour_tips_alter().
File
-
core/
modules/ language/ src/ Hook/ LanguageHooks.php, line 323
Class
- LanguageHooks
- Hook implementations for language.
Namespace
Drupal\language\HookCode
public function tourTipsAlter(array &$tour_tips, EntityInterface $entity) : void {
$module_extension_list = \Drupal::service('extension.list.module');
foreach ($tour_tips as $tour_tip) {
if ($tour_tip->get('id') == 'language-overview') {
$additional_overview = '';
if (\Drupal::service('module_handler')->moduleExists('locale')) {
$additional_overview = t("This page also provides an overview of how much of the site's interface has been translated for each configured language.");
}
else {
$additional_overview = t("If the Interface Translation module is installed, this page will provide an overview of how much of the site's interface has been translated for each configured language.");
}
$tour_tip->set('body', $tour_tip->get('body') . '<p>' . $additional_overview . '</p>');
}
elseif ($tour_tip->get('id') == 'language-continue') {
$additional_continue = '';
$additional_modules = [];
if (!\Drupal::service('module_handler')->moduleExists('locale')) {
$additional_modules[] = $module_extension_list->getName('locale');
}
if (!\Drupal::service('module_handler')->moduleExists('content_translation')) {
$additional_modules[] = $module_extension_list->getName('content_translation');
}
if (!empty($additional_modules)) {
$additional_continue = t('Depending on your site features, additional modules that you might want to install are:') . '<ul>';
foreach ($additional_modules as $additional_module) {
$additional_continue .= '<li>' . $additional_module . '</li>';
}
$additional_continue .= '</ul>';
}
if (!empty($additional_continue)) {
$tour_tip->set('body', $tour_tip->get('body') . '<p>' . $additional_continue . '</p>');
}
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.