more module updates

This commit is contained in:
Bachir Soussi Chiadmi
2015-04-20 18:19:49 +02:00
parent 2121a356b3
commit cde7b73a73
39 changed files with 660 additions and 258 deletions

View File

@@ -1,2 +1,33 @@
INTRODUCTION
------------
Provides common and resuable token UI elements and missing core tokens.
* For a full description of the module, visit the project page:
https://drupal.org/project/token
* To submit bug reports and feature suggestions, or to track changes:
https://drupal.org/project/issues/token
INSTALLATION
------------
Install as usual, see
https://drupal.org/documentation/install/modules-themes/modules-7 for further
information.
TROUBLESHOOTING
---------------
Token module doesn't provide any visible functions to the user on its own, it
just provides token handling services for other modules.
MAINTAINERS
-----------
Current maintainers:
* Dave Reid (https://drupal.org/user/53892)

View File

@@ -5,9 +5,9 @@ core = 7.x
files[] = token_test.module
hidden = TRUE
; Information added by drupal.org packaging script on 2013-02-24
version = "7.x-1.5"
; Information added by Drupal.org packaging script on 2015-02-28
version = "7.x-1.6"
core = "7.x"
project = "token"
datestamp = "1361665026"
datestamp = "1425149060"

View File

@@ -3,9 +3,9 @@ description = Provides a user interface for the Token API and some missing core
core = 7.x
files[] = token.test
; Information added by drupal.org packaging script on 2013-02-24
version = "7.x-1.5"
; Information added by Drupal.org packaging script on 2015-02-28
version = "7.x-1.6"
core = "7.x"
project = "token"
datestamp = "1361665026"
datestamp = "1425149060"

View File

@@ -180,7 +180,7 @@ function token_theme() {
'text' => NULL,
'options' => array(),
'dialog' => TRUE,
),
) + $info['token_tree']['variables'],
'file' => 'token.pages.inc',
);
@@ -273,8 +273,8 @@ function token_form_block_admin_configure_alter(&$form, $form_state) {
* Implements hook_widget_form_alter().
*/
function token_field_widget_form_alter(&$element, &$form_state, $context) {
if (!empty($element['#description']) && is_string($element['#description'])) {
$element['#description'] = filter_xss_admin(token_replace($element['#description']));
if (!empty($element['#description']) && !empty($context['instance']['description'])) {
$element['#description'] = filter_xss_admin(token_replace($context['instance']['description']));
}
}
@@ -412,12 +412,18 @@ function token_get_entity_mapping($value_type = 'token', $value = NULL, $fallbac
*/
function token_entity_info_alter(&$info) {
foreach (array_keys($info) as $entity_type) {
// Add a token view mode if it does not already exist.
if (!empty($info[$entity_type]['view modes']) && !isset($info[$entity_type]['view modes']['token'])) {
$info[$entity_type]['view modes']['token'] = array(
'label' => t('Tokens'),
'custom settings' => FALSE,
);
// Add a token view mode if it does not already exist. Only work with
// fieldable entities.
if (!empty($info[$entity_type]['fieldable'])) {
if (!isset($info[$entity_type])) {
$info[$entity_type]['view modes'] = array();
}
if (!isset($info[$entity_type]['view modes']['token'])) {
$info[$entity_type]['view modes']['token'] = array(
'label' => t('Tokens'),
'custom settings' => FALSE,
);
}
}
if (!empty($info[$entity_type]['token type'])) {
@@ -647,6 +653,10 @@ function token_get_invalid_tokens($type, $tokens) {
$invalid_tokens = array();
foreach ($tokens as $token => $full_token) {
if (isset($token_info['tokens'][$type][$token])) {
continue;
}
// Split token up if it has chains.
$parts = explode(':', $token, 2);

View File

@@ -19,7 +19,12 @@ function theme_token_tree_link($variables) {
}
$info = token_theme();
$variables['options']['query']['options'] = array_intersect_key($variables, $info['token_tree']['variables']);
$tree_variables = array_intersect_key($variables, $info['token_tree']['variables']);
$tree_variables = drupal_array_diff_assoc_recursive($tree_variables, $info['token_tree']['variables']);
if (!isset($variables['options']['query']['options'])) {
$variables['options']['query']['options'] = array();
}
$variables['options']['query']['options'] += $tree_variables;
// We should never pass the dialog option to theme_token_tree(). It is only
// used for this function.

View File

@@ -137,6 +137,7 @@ class TokenUnitTestCase extends TokenTestHelper {
'[node:created:short]',
'[node:created:custom:invalid]',
'[node:created:custom:mm-YYYY]',
'[node:colons:in:name]',
'[site:name]',
'[site:slogan]',
'[current-date:short]',
@@ -147,6 +148,7 @@ class TokenUnitTestCase extends TokenTestHelper {
'[node:title:invalid]',
'[node:created:invalid]',
'[node:created:short:invalid]',
'[node:colons:in:name:invalid]',
'[invalid:title]',
'[site:invalid]',
'[user:ip-address]',
@@ -166,6 +168,7 @@ class TokenUnitTestCase extends TokenTestHelper {
'[node:created:short]',
'[node:created:custom:invalid]',
'[node:created:custom:mm-YYYY]',
'[node:colons:in:name]',
'[site:name]',
'[site:slogan]',
'[user:uid]',
@@ -176,6 +179,7 @@ class TokenUnitTestCase extends TokenTestHelper {
'[node:title:invalid]',
'[node:created:invalid]',
'[node:created:short:invalid]',
'[node:colons:in:name:invalid]',
'[invalid:title]',
'[site:invalid]',
'[user:ip-address]',