Skip to content

Commit

Permalink
Merge pull request #8 from backdrop-contrib/robertgarrigos-patch-1
Browse files Browse the repository at this point in the history
Fixes #7: no token added on subdirectory installation
  • Loading branch information
robertgarrigos authored Oct 26, 2024
2 parents 809aee2 + fd64eda commit 2048a51
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions content_lock.module
Original file line number Diff line number Diff line change
Expand Up @@ -232,13 +232,13 @@ function content_lock_preprocess_views_view_field(&$var) {
$output = $var['output'];

//extract the path to create the token
$pattern = '/href="\/(node\/\d+\/edit)/';
$pattern = '/href=".*\/(node\/\d+\/edit)/';
preg_match($pattern, $output, $matches);
if (isset($matches[1])) {
$token_path = $matches[1];

// add token to href
$pattern = '/(href="\/node\/\d+\/edit[^"]*)/';
$pattern = '/(href=".*\/node\/\d+\/edit[^"]*)/';
$replacement = '$1&content_lock_token=' . backdrop_get_token($token_path);
$var['output'] = preg_replace($pattern, $replacement, $output);
}
Expand Down

0 comments on commit 2048a51

Please sign in to comment.