Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ao5357/a5b9d58407f0ef6e27b9b56e781db792 to your computer and use it in GitHub Desktop.
Save ao5357/a5b9d58407f0ef6e27b9b56e781db792 to your computer and use it in GitHub Desktop.
Patch to remove the contents of a token hook for harmony on our d7 site
diff --git a/token.tokens.inc b/token.tokens.inc
index 3d65d6e..d562559 100644
--- a/token.tokens.inc
+++ b/token.tokens.inc
@@ -9,83 +9,7 @@
* Implements hook_token_info_alter().
*/
function token_token_info_alter(&$info) {
- // Force 'date' type tokens to require input and add a 'current-date' type.
- // @todo Remove when http://drupal.org/node/943028 is fixed.
- $info['types']['date']['needs-data'] = 'date';
- $info['types']['current-date'] = array(
- 'name' => t('Current date'),
- 'description' => t('Tokens related to the current date and time.'),
- 'type' => 'date',
- );
-
- // Add a 'dynamic' key to any tokens that have chained but dynamic tokens.
- $info['tokens']['date']['custom']['dynamic'] = TRUE;
-
- // The [file:size] may not always return in kilobytes.
- // @todo Remove when http://drupal.org/node/1193044 is fixed.
- $info['tokens']['file']['size']['description'] = t('The size of the file.');
-
- // Remove deprecated tokens from being listed.
- unset($info['tokens']['node']['tnid']);
- unset($info['tokens']['node']['type']);
- unset($info['tokens']['node']['type-name']);
-
- // Support 'url' type tokens for core tokens.
- if (isset($info['tokens']['comment']['url']) && module_exists('comment')) {
- $info['tokens']['comment']['url']['type'] = 'url';
- }
- $info['tokens']['node']['url']['type'] = 'url';
- if (isset($info['tokens']['term']['url']) && module_exists('taxonomy')) {
- $info['tokens']['term']['url']['type'] = 'url';
- }
- $info['tokens']['user']['url']['type'] = 'url';
-
- // Add [token:url] tokens for any URI-able entities.
- $entities = entity_get_info();
- foreach ($entities as $entity => $entity_info) {
- if (!isset($entity_info['token type'])) {
- continue;
- }
-
- $token_type = $entity_info['token type'];
- if (!isset($info['types'][$token_type]) || !isset($info['tokens'][$token_type])) {
- continue;
- }
-
- // Add [entity:url] tokens if they do not already exist.
- // @todo Support entity:label
- if (!isset($info['tokens'][$token_type]['url']) && !empty($entity_info['uri callback'])) {
- $info['tokens'][$token_type]['url'] = array(
- 'name' => t('URL'),
- 'description' => t('The URL of the @entity.', array('@entity' => drupal_strtolower($entity_info['label']))),
- 'module' => 'token',
- 'type' => 'url',
- );
- }
-
- // Add [entity:original] tokens if they do not already exist.
- if (!isset($info['tokens'][$token_type]['original'])) {
- $info['tokens'][$token_type]['original'] = array(
- 'name' => t('Original @entity', array('@entity' => drupal_strtolower($entity_info['label']))),
- 'description' => t('The original @entity data if the @entity is being updated or saved.', array('@entity' => drupal_strtolower($entity_info['label']))),
- 'module' => 'token',
- 'type' => $token_type,
- );
- }
- }
-
- // Add support for custom date formats.
- // @todo Remove when http://drupal.org/node/1173706 is fixed.
- $date_format_types = system_get_date_types();
- foreach ($date_format_types as $date_format_type => $date_format_type_info) {
- if (!isset($info['tokens']['date'][$date_format_type])) {
- $info['tokens']['date'][$date_format_type] = array(
- 'name' => check_plain($date_format_type_info['title']),
- 'description' => t("A date in '@type' format. (%date)", array('@type' => $date_format_type, '%date' => format_date(REQUEST_TIME, $date_format_type))),
- 'module' => 'token',
- );
- }
- }
+ // Removing the info alter appears to resolve some site-specific issues.
}
/**
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment