Commit 2f9585ba authored by elaman's avatar elaman Committed by joelpittet

Issue #2931292 by elaman, joelpittet: Provided tokens don't work with Panels module

parent 084122d2
......@@ -452,27 +452,28 @@ function node_authlink_tokens($type, $tokens, array $data = [], array $options =
return;
}
$replacements = [];
if (isset($tokens['authlink:authkey'])) {
$replacements['[node:authlink:authkey]'] = $data['node']->authkey;
}
if (isset($tokens['authlink:view-url'])) {
$replacements['[node:authlink:view-url]'] = node_authlink_get_url($data['node'], 'view');
}
if (isset($tokens['authlink:edit-url'])) {
$replacements['[node:authlink:edit-url]'] = node_authlink_get_url($data['node'], 'update');
}
if (isset($tokens['authlink:delete-url'])) {
$replacements['[node:authlink:delete-url]'] = node_authlink_get_url($data['node'], 'delete');
if ($type == 'node' && !empty($data['node']->authkey)) {
$node = $data['node'];
foreach ($tokens as $name => $original) {
switch ($name) {
case 'authlink:authkey':
$replacements[$original] = $node->authkey;
break;
case 'authlink:view-url':
$replacements[$original] = node_authlink_get_url($node, 'view');
break;
case 'authlink:edit-url':
$replacements[$original] = node_authlink_get_url($node, 'update');
break;
case 'authlink:delete-url':
$replacements[$original] = node_authlink_get_url($node, 'delete');
break;
}
}
}
return $replacements;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment