wisski_cloud_account_manager/wisski_cloud_account_manager.module
2023-10-23 09:51:43 +02:00

74 lines
2.6 KiB
Text
Executable file

<?php
use Drupal\Core\Mail\MailManagerInterface;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Component\Utility\Html;
/**
* Implements hook_help().
*/
function wisski_cloud_account_manager_help($route_name, \Drupal\Core\Routing\RouteMatchInterface $route_match) {
$output = '';
switch ($route_name) {
case 'help.page.wisski_cloud_account_manager':
$output .= '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('This module provides the functionality to create, validate and manage WissKI Cloud accounts.') . '</p>';
$output .= '<h3>' . t('Configuration') . '</h3>';
$output .= '<p>' . t('Configuration is done on the <a href="@settingsPage" targer="_blank">settings page</a>.', ['@settingsPage' => '/admin/config/wisski-cloud-account-manager/settings']) . '</p>';
$output .= '<h3>' . t('Create WissKI Cloud Account') . '</h3>';
$output .= '<p>' . t('<a href="@createPage" targer="_blank">This page</a> allows you to create a WissKI Cloud account.', ['@createPage' => '/wisski-cloud-account-manager/create']) . '</p>';
$output .= '<h3>' . t('Validate WissKI Cloud Account') . '</h3>';
$output .= '<p>' . t('<a href="@validationPage" targer="_blank">This page</a> allows you to validate your account and check the status of the provision.', ['@validationPage' => '/wisski-cloud-account-manager/validate/GsyMv5DdFhPCixL1wTLZhzFg7sVDOiHq']) . '</p>';
break;
}
return $output;
}
/**
* Implements hook_mail().
*/
function wisski_cloud_account_manager_mail($key, &$message, $params) {
$options = [
'langcode' => $message['langcode'],
];
switch ($key) {
case 'wisski_cloud_account_validation':
$message['from'] = \Drupal::config('system.site')->get('mail');
$message['subject'] = t('@subject', ['@subject' => $params['subject']], $options);
$message['body'][] = $params['message'];
$headers = [
'Content-Type' => 'text/html; charset=UTF-8; format=flowed',
'MIME-Version' => '1.0',
'Content-Transfer-Encoding' => '8Bit',
'X-Mailer' => 'Drupal',
];
$message['headers'] = $headers;
break;
}
}
/**
* Implements hook_theme().
*/
function wisski_cloud_account_manager_theme($existing, $type, $theme, $path) {
return [
'wisski_cloud_account_manager_terms_and_conditions_page' => [
'variables' => ['date' => NULL],
],
'wisski_cloud_account_manager_account_managing_page' => [
'variables' => ['accounts' => NULL],
],
'wisski_cloud_account_manager_validation_page' => [
'variables' => ['account' => NULL],
],
];
}