You are here

language_selection_page.module in Language Selection Page 8.2

File

language_selection_page.module
View source
<?php

/**
 * @file
 * Main module file.
 */
declare (strict_types=1);
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Url;

/**
 * Implements hook_theme().
 */
function language_selection_page_theme($existing, $type, $theme, $path) {
  return [
    'language_selection_page_content' => [
      'render element' => 'custom_page',
      'path' => $path . '/templates',
      'template' => 'language-selection-page-content',
      'variables' => [
        'destination' => NULL,
        'configure_url' => Url::fromRoute('language.negotiation'),
        'language_links' => '',
      ],
    ],
  ];
}

/**
 * Implements hook_help().
 */
function language_selection_page_help($route_name, RouteMatchInterface $route_match) {
  $output = '';
  if ($route_name === 'help.page.language_selection_page') {
    $output .= '<h3>' . t('About') . '</h3>';
    $output .= '<p>' . t('This module allows you to present visitors of your website with a landing page / splash page where they can select the language of their choice, based on the languages that have been enabled on your Drupal site.</br>For more information please visit the <a href="@link">module page</a>.', [
      '@link' => 'https://www.drupal.org/project/language_selection_page',
    ]) . '</p>';
    $output .= '<h3>' . t('Configuring') . '</h3>';
    $output .= '<p>' . t('Go to admin/config/regional/language/configure to configure language detection and selection</br>- enable the "Selection Page" detection method</br>- it is recommended to position this method near the bottom, just above "Default".') . '</p>';
    $output .= '<h3>' . t('Theming') . '</h3>';
    $output .= '<p>' . t('Customize the template by copying the .tpl.php file to your current theme directory.</br>If you selected "Template in theme", you might want to add a page--languageselection.tpl.php file to your theme, that removes any sidebars or regions that could intervene with the language selection task.') . '</p>';
  }
  return $output;
}

Functions