56 lines
1.5 KiB
Plaintext
56 lines
1.5 KiB
Plaintext
<?php
|
|
|
|
/**
|
|
* @file
|
|
* Contains opencase_defaults.module.
|
|
*/
|
|
|
|
use Drupal\Core\Routing\RouteMatchInterface;
|
|
use Drupal\user\Entity\Role;
|
|
use Drupal\user\RoleInterface;
|
|
|
|
/**
|
|
* When a new actor type is created, this gives the CRM Admin and Overseer roles permission
|
|
* to view, edit and delete them.
|
|
*/
|
|
#function opencase_defaults_entity_insert(Drupal\Core\Entity\EntityInterface $entity) {
|
|
# if (get_class($entity) == 'Drupal\opencase_entities\Entity\OCActorType') {
|
|
# $type = $entity->id();
|
|
# $roles = Role::loadMultiple(['opencase_admin', 'overseer']);
|
|
# foreach ($roles as $role) {
|
|
# $role->grantPermission("view published $type entities");
|
|
# $role->grantPermission("edit $type entities");
|
|
# $role->grantPermission("delete $type entities");
|
|
# $role->grantPermission("add new $type entities");
|
|
# }
|
|
# \Drupal::logger('foo')->notice("<pre>".print_r(user_role_permissions(['overseer']), true) . "</pre>");
|
|
# }
|
|
#}
|
|
|
|
/**
|
|
* 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_theme().
|
|
*/
|
|
function opencase_defaults_theme() {
|
|
return [
|
|
'opencase_defaults' => [
|
|
'render element' => 'children',
|
|
],
|
|
];
|
|
}
|