updated token module
This commit is contained in:
Executable → Regular
Executable → Regular
+31
@@ -1,2 +1,33 @@
|
|||||||
|
INTRODUCTION
|
||||||
|
------------
|
||||||
|
|
||||||
Provides common and resuable token UI elements and missing core tokens.
|
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)
|
||||||
Executable → Regular
|
Before Width: | Height: | Size: 118 B After Width: | Height: | Size: 118 B |
Executable → Regular
|
Before Width: | Height: | Size: 127 B After Width: | Height: | Size: 127 B |
Executable → Regular
Executable → Regular
Executable → Regular
+3
-3
@@ -5,9 +5,9 @@ core = 7.x
|
|||||||
files[] = token_test.module
|
files[] = token_test.module
|
||||||
hidden = TRUE
|
hidden = TRUE
|
||||||
|
|
||||||
; Information added by drupal.org packaging script on 2013-02-24
|
; Information added by Drupal.org packaging script on 2015-02-28
|
||||||
version = "7.x-1.5"
|
version = "7.x-1.6"
|
||||||
core = "7.x"
|
core = "7.x"
|
||||||
project = "token"
|
project = "token"
|
||||||
datestamp = "1361665026"
|
datestamp = "1425149060"
|
||||||
|
|
||||||
|
|||||||
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
+3
-3
@@ -3,9 +3,9 @@ description = Provides a user interface for the Token API and some missing core
|
|||||||
core = 7.x
|
core = 7.x
|
||||||
files[] = token.test
|
files[] = token.test
|
||||||
|
|
||||||
; Information added by drupal.org packaging script on 2013-02-24
|
; Information added by Drupal.org packaging script on 2015-02-28
|
||||||
version = "7.x-1.5"
|
version = "7.x-1.6"
|
||||||
core = "7.x"
|
core = "7.x"
|
||||||
project = "token"
|
project = "token"
|
||||||
datestamp = "1361665026"
|
datestamp = "1425149060"
|
||||||
|
|
||||||
|
|||||||
Executable → Regular
Executable → Regular
Executable → Regular
+19
-9
@@ -180,7 +180,7 @@ function token_theme() {
|
|||||||
'text' => NULL,
|
'text' => NULL,
|
||||||
'options' => array(),
|
'options' => array(),
|
||||||
'dialog' => TRUE,
|
'dialog' => TRUE,
|
||||||
),
|
) + $info['token_tree']['variables'],
|
||||||
'file' => 'token.pages.inc',
|
'file' => 'token.pages.inc',
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -273,8 +273,8 @@ function token_form_block_admin_configure_alter(&$form, $form_state) {
|
|||||||
* Implements hook_widget_form_alter().
|
* Implements hook_widget_form_alter().
|
||||||
*/
|
*/
|
||||||
function token_field_widget_form_alter(&$element, &$form_state, $context) {
|
function token_field_widget_form_alter(&$element, &$form_state, $context) {
|
||||||
if (!empty($element['#description']) && is_string($element['#description'])) {
|
if (!empty($element['#description']) && !empty($context['instance']['description'])) {
|
||||||
$element['#description'] = filter_xss_admin(token_replace($element['#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) {
|
function token_entity_info_alter(&$info) {
|
||||||
foreach (array_keys($info) as $entity_type) {
|
foreach (array_keys($info) as $entity_type) {
|
||||||
// Add a token view mode if it does not already exist.
|
// Add a token view mode if it does not already exist. Only work with
|
||||||
if (!empty($info[$entity_type]['view modes']) && !isset($info[$entity_type]['view modes']['token'])) {
|
// fieldable entities.
|
||||||
$info[$entity_type]['view modes']['token'] = array(
|
if (!empty($info[$entity_type]['fieldable'])) {
|
||||||
'label' => t('Tokens'),
|
if (!isset($info[$entity_type])) {
|
||||||
'custom settings' => FALSE,
|
$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'])) {
|
if (!empty($info[$entity_type]['token type'])) {
|
||||||
@@ -647,6 +653,10 @@ function token_get_invalid_tokens($type, $tokens) {
|
|||||||
$invalid_tokens = array();
|
$invalid_tokens = array();
|
||||||
|
|
||||||
foreach ($tokens as $token => $full_token) {
|
foreach ($tokens as $token => $full_token) {
|
||||||
|
if (isset($token_info['tokens'][$type][$token])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Split token up if it has chains.
|
// Split token up if it has chains.
|
||||||
$parts = explode(':', $token, 2);
|
$parts = explode(':', $token, 2);
|
||||||
|
|
||||||
|
|||||||
Executable → Regular
+6
-1
@@ -19,7 +19,12 @@ function theme_token_tree_link($variables) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$info = token_theme();
|
$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
|
// We should never pass the dialog option to theme_token_tree(). It is only
|
||||||
// used for this function.
|
// used for this function.
|
||||||
|
|||||||
Executable → Regular
+4
@@ -137,6 +137,7 @@ class TokenUnitTestCase extends TokenTestHelper {
|
|||||||
'[node:created:short]',
|
'[node:created:short]',
|
||||||
'[node:created:custom:invalid]',
|
'[node:created:custom:invalid]',
|
||||||
'[node:created:custom:mm-YYYY]',
|
'[node:created:custom:mm-YYYY]',
|
||||||
|
'[node:colons:in:name]',
|
||||||
'[site:name]',
|
'[site:name]',
|
||||||
'[site:slogan]',
|
'[site:slogan]',
|
||||||
'[current-date:short]',
|
'[current-date:short]',
|
||||||
@@ -147,6 +148,7 @@ class TokenUnitTestCase extends TokenTestHelper {
|
|||||||
'[node:title:invalid]',
|
'[node:title:invalid]',
|
||||||
'[node:created:invalid]',
|
'[node:created:invalid]',
|
||||||
'[node:created:short:invalid]',
|
'[node:created:short:invalid]',
|
||||||
|
'[node:colons:in:name:invalid]',
|
||||||
'[invalid:title]',
|
'[invalid:title]',
|
||||||
'[site:invalid]',
|
'[site:invalid]',
|
||||||
'[user:ip-address]',
|
'[user:ip-address]',
|
||||||
@@ -166,6 +168,7 @@ class TokenUnitTestCase extends TokenTestHelper {
|
|||||||
'[node:created:short]',
|
'[node:created:short]',
|
||||||
'[node:created:custom:invalid]',
|
'[node:created:custom:invalid]',
|
||||||
'[node:created:custom:mm-YYYY]',
|
'[node:created:custom:mm-YYYY]',
|
||||||
|
'[node:colons:in:name]',
|
||||||
'[site:name]',
|
'[site:name]',
|
||||||
'[site:slogan]',
|
'[site:slogan]',
|
||||||
'[user:uid]',
|
'[user:uid]',
|
||||||
@@ -176,6 +179,7 @@ class TokenUnitTestCase extends TokenTestHelper {
|
|||||||
'[node:title:invalid]',
|
'[node:title:invalid]',
|
||||||
'[node:created:invalid]',
|
'[node:created:invalid]',
|
||||||
'[node:created:short:invalid]',
|
'[node:created:short:invalid]',
|
||||||
|
'[node:colons:in:name:invalid]',
|
||||||
'[invalid:title]',
|
'[invalid:title]',
|
||||||
'[site:invalid]',
|
'[site:invalid]',
|
||||||
'[user:ip-address]',
|
'[user:ip-address]',
|
||||||
|
|||||||
Executable → Regular
Reference in New Issue
Block a user