You are here

function content_lock_content_lock_path_protected in Content locking (anti-concurrent editing) 7.2

Same name and namespace in other branches
  1. 7.3 content_lock.module \content_lock_content_lock_path_protected()

Implements hook_content_lock_path_protected().

File

./content_lock.module, line 171
Allows users to lock documents for modification.

Code

function content_lock_content_lock_path_protected($path) {

  // Always protect node edit and revert paths.
  if (strpos($path, 'node/') === 0) {
    $paths_patterns = array(
      'node/*/edit',
      'node/*/edit/*',
      'node/*/revisions/*/revert',
    );
    foreach ($paths_patterns as $protected_pattern) {
      if (drupal_match_path($path, $protected_pattern)) {
        return TRUE;
      }
    }
  }

  // Allow extended tests via protection_menu_token module.
  if (function_exists('protection_menu_token_is_path_protected')) {
    return protection_menu_token_is_path_protected($path);
  }
}