o365-2.0.3/o365.module
o365.module
<?php
/**
* @file
* Contains o365.module.
*/
/**
* Implements hook_theme().
*/
function o365_theme($existing, $type, $theme, $path) {
$return = [];
$return['o365_auth_scopes_table'] = [
'variables' => [
'scopes' => NULL,
],
'render element' => 'children',
];
$return['o365_brandicon'] = [
'variables' => [
'size' => NULL,
'type' => NULL,
'classes' => NULL,
],
'render element' => 'children',
];
$personaRenderModes = ['small', 'medium', 'large'];
foreach ($personaRenderModes as $renderMode) {
$return['o365_persona_render_' . $renderMode] = [
'variables' => [
'userData' => NULL,
'config' => NULL,
],
'render element' => 'children',
];
}
return $return;
}
/**
* Implements hook_preprocess_HOOK().
*/
function o365_preprocess_o365_persona_render_small(&$variables) {
// Set some default config values, if not present.
$default = [
'size' => '24X24',
'show_presence' => TRUE,
];
if (!isset($variables['config'])) {
$variables['config'] = $default;
}
if (!isset($variables['config']['size'])) {
$variables['config']['size'] = $default['size'];
}
if (!isset($variables['config']['show_presence'])) {
$variables['config']['show_presence'] = $default['show_presence'];
}
}
/**
* Implements hook_o365_auth_scopes().
*/
function o365_o365_auth_scopes(array &$scopes) {
$scopes[] = 'openid';
$scopes[] = 'offline_access';
$scopes[] = 'email';
$scopes[] = 'User.Read';
}
/**
* Implements hook_preprocess_HOOK().
*/
function o365_preprocess_block(&$variables) {
if (strpos($variables['plugin_id'], 'o365_') === 0) {
$variables['attributes']['class'][] = 'o365-block';
}
}
