You are here

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

Same name and namespace in other branches
  1. 7.3 content_lock.api.php \hook_content_lock_path_protected()

Control protected paths for node edit forms.

The hook is typically implemented to check if a path should be protected for CSRF attacks on the node edit forms.

Parameters

string $path: The path to check protection for.

Return value

bool TRUE is the path should be protected. Note: this grant is permissive rather than restrictive.

See also

hook_field_access()

1 function implements hook_content_lock_path_protected()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

content_lock_content_lock_path_protected in ./content_lock.module
Implements hook_content_lock_path_protected().
1 invocation of hook_content_lock_path_protected()
content_lock_is_path_protected in ./content_lock.module
Check if an internal Drupal path should be protected with a token.

File

./content_lock.api.php, line 34
Document content_lock hooks.

Code

function hook_content_lock_path_protected($path) {
  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;
      }
    }
  }
}