You are here

function _copyprevention_is_enabled in Copy Prevention 8

Returns whether or not copyprevention should be enabled.

Return value

bool

2 calls to _copyprevention_is_enabled()
copyprevention_page_attachments in ./copyprevention.module
Implements hook_page_attachments().
copyprevention_preprocess_html in ./copyprevention.module
Implements hook_preprocess_html().

File

./copyprevention.module, line 88
Main file for Copy Prevention module.

Code

function _copyprevention_is_enabled() {
  $enable =& drupal_static(__FUNCTION__);
  if (isset($enable)) {
    return $enable;
  }
  $enable = TRUE;
  if (\Drupal::currentUser()
    ->hasPermission('bypass copy prevention')) {
    $enable = FALSE;
  }
  else {
    $module_handler = \Drupal::moduleHandler();
    $module_handler
      ->alter('copyprevention_enable', $enable);
  }
  return $enable;
}