function language_tour_tips_alter

language_tour_tips_alter(array &$tour_tips, EntityInterface $entity)

Implements hook_tour_tips_alter().

File

core/modules/language/language.module, line 451
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>');
      }
    }
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!language!language.module/function/language_tour_tips_alter/8.1.x