diff --git a/js/search-reference.js b/js/search-reference.js index 56edc4e..8740383 100644 --- a/js/search-reference.js +++ b/js/search-reference.js @@ -5,16 +5,21 @@ // We can't combine all of these, since that causes // JQuery.each() to freak ut.' var selector = null; - if ($('table.views-table').length > 0) { - selector = $('table.views-table tbody tr:not(.views-table-row-select-all)'); + // Check for elements matching any of the desired selectors. + if ($('table.views-table', context).length > 0) { + // Use the views-table if found. + selector = $('table.views-table tbody tr:not(.views-table-row-select-all)', context); } - else if ($('table.views-view-grid').length > 0) { - selector = $('table.views-view-grid td'); + else if ($('table.views-view-grid', context).length > 0) { + // Use views-view-grid if found. + selector = $('table.views-view-grid td', context); } - else if ($('.views-row').length > 0) { - selector = $('.views-row'); + else if ($('.views-row', context).length > 0) { + // Use views-row if found. + selector = $('.views-row', context); } else { + // If no elements match any of the selectors, exit. return; } selector.each(function(index) { diff --git a/references_dialog.module b/references_dialog.module index 771bdf2..a5f7e67 100644 --- a/references_dialog.module +++ b/references_dialog.module @@ -5,6 +5,43 @@ * This the main module file. */ +/** + * Implements hook_autoload_info(). + */ +function references_dialog_autoload_info() { + return array( + 'references_dialog_plugin_display' => 'views/references_dialog_plugin_display.inc', + ); +} + +/** + * Implements hook_menu(). + */ +function references_dialog_menu() { + $items = array(); + // This redirect callback is used when adding and editing content in + // the overlay. When content is created or edited, we are directed here, + // so we can act properly on entities. + $items['references-dialog/redirect/%/%'] = array( + 'page callback' => 'references_dialog_redirect_page', + 'page arguments' => array(2, 3), + 'access callback' => 'references_dialog_redirect_access', + 'access arguments' => array(2, 3), + ); + return $items; +} + +/** + * Implements hook_theme(). + */ +function references_dialog_theme() { + return array( + 'references_dialog_links' => array( + 'variables' => array('links' => NULL), + ), + ); +} + /** * Implements hook_element_info(). */ @@ -42,32 +79,6 @@ function references_dialog_element_info_alter(&$info) { } } -/** - * Implements hook_autoload_info(). - */ -function references_dialog_autoload_info() { - return array( - 'references_dialog_plugin_display' => 'views/references_dialog_plugin_display.inc', - ); -} - -/** - * Implements hook_menu(). - */ -function references_dialog_menu() { - $items = array(); - // This redirect callback is used when adding and editing content in - // the overlay. When content is created or edited, we are directed here, - // so we can act properly on entities. - $items['references-dialog/redirect/%/%'] = array( - 'page callback' => 'references_dialog_redirect_page', - 'page arguments' => array(2, 3), - 'access callback' => 'references_dialog_redirect_access', - 'access arguments' => array(2, 3), - ); - return $items; -} - /** * Implements hook_admin_paths(). */ @@ -393,17 +404,6 @@ function references_dialog_js_settings($id, array $settings) { ); } -/** - * Implements hook_theme(). - */ -function references_dialog_theme() { - return array( - 'references_dialog_links' => array( - 'variables' => array('links' => NULL), - ), - ); -} - /** * Implements hook_entity_insert(). */ @@ -543,6 +543,18 @@ function references_dialog_get_views_search_links($attachable) { return $links; } +/** + * Implements hook_preprocess_page(). + */ +function references_dialog_preprocess_page(&$variables) { + + if (references_dialog_in_dialog()) { + $variables['page'] = '