Skip to content

Instantly share code, notes, and snippets.

@tkuldeep
Created July 7, 2017 05:43
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 tkuldeep/1f3bccb604b8ed0c4353ed3faa700b01 to your computer and use it in GitHub Desktop.
Save tkuldeep/1f3bccb604b8ed0c4353ed3faa700b01 to your computer and use it in GitHub Desktop.
diff --git a/token_insert.module b/token_insert.module
index 311379a..8a826ff 100644
--- a/token_insert.module
+++ b/token_insert.module
@@ -186,6 +186,9 @@ function theme_token_insert_tree() {
$rows[] = $row;
}
}
+
+ // Add hook for altering tokens
+ drupal_alter('token_insert', $rows);
$element = array(
'#theme' => 'tree_table',
'#header' => array(
diff --git a/token_insert_wysiwyg/plugins/token_insert_wysiwyg/token_insert_wysiwyg.js b/token_insert_wysiwyg/plugins/token_insert_wysiwyg/token_insert_wysiwyg.js
index 06e8961..d7e3e55 100644
--- a/token_insert_wysiwyg/plugins/token_insert_wysiwyg/token_insert_wysiwyg.js
+++ b/token_insert_wysiwyg/plugins/token_insert_wysiwyg/token_insert_wysiwyg.js
@@ -134,8 +134,10 @@
$dialogdiv.find('.token-insert-table .token-key').once('token-insert-table', function() {
var newThis = $('<a href="javascript:void(0);" title="' + Drupal.t('Insert this token into your form') + '">' + $(this).html() + '</a>').click(function(e){
e.preventDefault();
- var token = $(this).text();
+ var token = $(this).html();
Drupal.wysiwyg.plugins.token_insert_wysiwyg.insertIntoEditor(token, instanceId);
+ // Close dialog after one token insert.
+ $dialogdiv.dialog('close');
});
$(this).html(newThis);
});
@@ -154,7 +156,7 @@
autoresize: true,
namespace: 'jquery_ui_dialog_default_ns',
dialogClass: 'jquery_ui_dialog-dialog',
- title: Drupal.t('Insert token'),
+ title: Drupal.t('Select a token to insert into text'),
buttons: btns,
width: 700
});
diff --git a/token_insert_wysiwyg/token_insert_wysiwyg.module b/token_insert_wysiwyg/token_insert_wysiwyg.module
index 0cc2e47..9cddbdb 100644
--- a/token_insert_wysiwyg/token_insert_wysiwyg.module
+++ b/token_insert_wysiwyg/token_insert_wysiwyg.module
@@ -64,6 +64,6 @@ function token_insert_wysiwyg_page($wysiwyg_instance_id) {
function token_insert_wysiwyg_custom_theme() {
if (strpos(current_path(), 'token_insert_wysiwyg/insert') === 0) {
- return 'seven';
+ return 'synapp';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment