The module has an exception for the Masquerade module. It would me nice if this module allowed other module developers to exempt a user from accepting the T&C. This is a follow up from π Add exemption api to allow a Masquerade module exemption Needs review .
Consider the following workflow. A site allows users to create users and assigns them a role on registration. However, in order to post comments the user must first accept the T&C of the site before they are allowed to create comments. All the developer would have to do is implement the hook.
/**
* Tells the Legal Module to exempt a user from accepting the Legal forms.
*
* @param $is_exempt
* Set to TRUE if the user is exempt from the legal module requirements.
*/
function hook_is_legal_exempt(&$is_exempt) {
// Masquerading users are exempt from the legal module requirement.
if (\Drupal::service('module_handler')->moduleExists('masquerade')) {
if (\Drupal::service('masquerade')->isMasquerading()) {
return TRUE;
}
}
}
I already created a MR that allows for this. See https://git.drupalcode.org/project/legal/-/merge_requests/14
Maintainer approval and commit.
none
Adds a hook.
/**
* Tells the Legal Module to exempt a user from accepting the Legal forms.
*
* @param $is_exempt
* Set to TRUE if the user is exempt from the legal module requirements.
*/
function hook_is_legal_exempt(&$is_exempt) {
// Masquerading users are exempt from the legal module requirement.
if (\Drupal::service('module_handler')->moduleExists('masquerade')) {
if (\Drupal::service('masquerade')->isMasquerading()) {
return TRUE;
}
}
}
none
Active
3.0
Code