function language_tour_tips_alter in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/modules/language/language.module \language_tour_tips_alter()
Implements hook_tour_tips_alter().
File
- core/
modules/ language/ language.module, line 446 - Add language handling functionality to Drupal.
Code
function language_tour_tips_alter(array &$tour_tips, EntityInterface $entity) {
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 enabled, 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 = array();
if (!Drupal::service('module_handler')
->moduleExists('locale')) {
$additional_modules[] = Drupal::service('module_handler')
->getName('locale');
}
if (!Drupal::service('module_handler')
->moduleExists('content_translation')) {
$additional_modules[] = Drupal::service('module_handler')
->getName('content_translation');
}
if (!empty($additional_modules)) {
$additional_continue = t('Depending on your site features, additional modules that you might want to enable 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>');
}
}
}
}