Commit 1983aed4 authored by Dries's avatar Dries

- Patch #590014 by sun, mr.baileys | Dries: fixed undefined language when...

- Patch #590014 by sun, mr.baileys | Dries: fixed undefined language when language is specified in .
parent 7178f6b1
......@@ -113,8 +113,8 @@ function comment_token_info() {
function comment_tokens($type, $tokens, array $data = array(), array $options = array()) {
$url_options = array('absolute' => TRUE);
if (isset($options['language'])) {
$url_options['language'] = $language;
$language_code = $language->language;
$url_options['language'] = $options['language'];
$language_code = $options['language']->language;
}
else {
$language_code = NULL;
......
......@@ -97,8 +97,8 @@ function node_token_info() {
function node_tokens($type, $tokens, array $data = array(), array $options = array()) {
$url_options = array('absolute' => TRUE);
if (isset($options['language'])) {
$url_options['language'] = $language;
$language_code = $language->language;
$url_options['language'] = $options['language'];
$language_code = $options['language']->language;
}
else {
$language_code = NULL;
......
......@@ -1185,7 +1185,7 @@ class TokenReplaceTestCase extends DrupalWebTestCase {
$account = $this->drupalCreateUser();
$node = $this->drupalCreateNode(array('uid' => $account->uid));
$node->title = '<blink>Blinking Text</blink>';
global $user;
global $user, $language;
$source = '[node:title]'; // Title of the node we passed in
$source .= '[node:author:name]'; // Node author's name
......@@ -1197,13 +1197,13 @@ class TokenReplaceTestCase extends DrupalWebTestCase {
$target = check_plain($node->title);
$target .= check_plain($account->name);
$target .= format_interval(REQUEST_TIME - $node->created, 2);
$target .= format_interval(REQUEST_TIME - $node->created, 2, $language->language);
$target .= check_plain($user->name);
$target .= '[user:name]';
$target .= format_date(REQUEST_TIME, 'short');
$target .= format_date(REQUEST_TIME, 'short', '', NULL, $language->language);
$target .= '[bogus:token]';
$result = token_replace($source, array('node' => $node));
$result = token_replace($source, array('node' => $node), array('language' => $language));
// Check that the results of token_generate are sanitized properly. This does NOT
// test the cleanliness of every token -- just that the $sanitize flag is being
......
......@@ -41,6 +41,7 @@ function user_token_info() {
'name' => t("Edit URL"),
'description' => t("The url of the account edit page."),
);
$user['last-login'] = array(
'name' => t("Last login"),
'description' => t("The date the user last logged in to the site."),
......@@ -65,8 +66,8 @@ function user_tokens($type, $tokens, array $data = array(), array $options = arr
global $user;
$url_options = array('absolute' => TRUE);
if (isset($options['language'])) {
$url_options['language'] = $language;
$language_code = $language->language;
$url_options['language'] = $options['language'];
$language_code = $options['language']->language;
}
else {
$language_code = NULL;
......
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