2f485f19c5
They were previously in opencase itself but are not needed for GNO
64 lines
1.7 KiB
Plaintext
64 lines
1.7 KiB
Plaintext
<?php
|
|
|
|
/**
|
|
* @file
|
|
* Contains opencase_defaults.module.
|
|
*/
|
|
|
|
use Drupal\Core\Routing\RouteMatchInterface;
|
|
use Drupal\user\Entity\Role;
|
|
use Drupal\user\RoleInterface;
|
|
|
|
/**
|
|
* Implements hook_help().
|
|
*/
|
|
function opencase_defaults_help($route_name, RouteMatchInterface $route_match) {
|
|
switch ($route_name) {
|
|
// Main module help for the opencase_defaults module.
|
|
case 'help.page.opencase_defaults':
|
|
$output = '';
|
|
$output .= '<h3>' . t('About') . '</h3>';
|
|
$output .= '<p>' . t('OpenCase Default Configuration') . '</p>';
|
|
return $output;
|
|
|
|
default:
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Implements hook_preprocess_page_title
|
|
*
|
|
* Modify the page title to include more information
|
|
*/
|
|
function opencase_defaults_preprocess_page_title(&$variables) {
|
|
|
|
$route_name = \Drupal::routeMatch()->getRouteName();
|
|
switch ($route_name) {
|
|
case 'entity.oc_case.canonical':
|
|
$case = \Drupal::routeMatch()->getParameter('oc_case');
|
|
$variables['title'] = $case->getName() . ": Case Details and Files";
|
|
break;
|
|
case 'view.cases.page_1':
|
|
$actor_id = \Drupal::routeMatch()->getParameter('actor_id');
|
|
$actor = \Drupal::entityTypeManager()->getStorage('oc_actor')->load($actor_id);
|
|
$variables['title'] = $actor->getName() . ": Cases";
|
|
break;
|
|
case 'view.activities.page_1':
|
|
$case_id = \Drupal::routeMatch()->getParameter('case_id');
|
|
$case = \Drupal::entityTypeManager()->getStorage('oc_case')->load($case_id);
|
|
$variables['title'] = $case->getName() . ": Activities";
|
|
break;
|
|
}
|
|
}
|
|
/**
|
|
* Implements hook_theme().
|
|
*/
|
|
function opencase_defaults_theme() {
|
|
return [
|
|
'opencase_defaults' => [
|
|
'render element' => 'children',
|
|
],
|
|
];
|
|
}
|
|
|