diff --git a/web/app/plugins/mitlib-multisearch-widget/class-multisearch-widget.php b/web/app/plugins/mitlib-multisearch-widget/class-multisearch-widget.php
index 9e73e7c6..963e8819 100644
--- a/web/app/plugins/mitlib-multisearch-widget/class-multisearch-widget.php
+++ b/web/app/plugins/mitlib-multisearch-widget/class-multisearch-widget.php
@@ -32,124 +32,58 @@ public function __construct() {
* @link https://developer.wordpress.org/reference/classes/wp_widget/
*/
public function widget( $args, $instance ) {
- // Identify which templates are needed based on instance variable.
- $all_template = 'templates/tab-all-eds.php';
- $books_template = 'templates/tab-books-eds.php';
- $articles_template = 'templates/tab-articles-eds.php';
- $articles_tab_name = 'Journals + articles';
- $more_template = 'templates/tab-more-eds.php';
- if ( 'alma' == $instance['targets'] ) {
- $all_template = 'templates/tab-all-alma.php';
- $books_template = 'templates/tab-books-alma.php';
- $articles_template = 'templates/tab-articles-alma.php';
- $articles_tab_name = 'Articles + chapters';
- $more_template = 'templates/tab-more-alma.php';
- }
+ // Strip initial arguments.
+ $args = null;
+
+ // By default, we use the v2 template (suitable for v2 page layouts).
+ $all_template = 'templates/tab-all-use-v2.php';
if ( 'use' == $instance['targets'] ) {
+ // Alternatively, we use the v1 template (for old page layouts).
$all_template = 'templates/tab-all-use.php';
}
- if ( 'use-v2' == $instance['targets'] ) {
- $all_template = 'templates/tab-all-use-v2.php';
- }
- // Strip initial arguments.
- $args = null;
// Register / enqueue javascript.
- // First we add the responsive tabs plugin.
- wp_register_script(
- 'responsivetabs-js',
- plugin_dir_url( __FILE__ ) . 'libs/jquery.responsiveTabs.min.js',
- array( 'jquery' ),
- '1.6.1',
- false
- );
// Second, we add this plugin's javascript.
wp_register_script(
'multisearch-js',
plugin_dir_url( __FILE__ ) . 'mitlib-multisearch-widget.js',
- array( 'responsivetabs-js' ),
- '1.4.1',
+ array(),
+ '1.8.0',
false
);
// Finally, we enquey only this plugin's javascript (which brings everything else in).
wp_enqueue_script( 'multisearch-js' );
// Register / enqueue styles.
- wp_register_style( 'responsivetabs-css', plugin_dir_url( __FILE__ ) . 'libs/responsive-tabs.css', '', '1.6.1' );
wp_register_style(
'multisearch-tabs',
plugin_dir_url( __FILE__ ) . 'mitlib-multisearch-widget.css',
- array( 'responsivetabs-css' ),
- '1.3.0'
+ array(),
+ '1.8.0'
);
wp_enqueue_style( 'multisearch-tabs' );
- if ( $instance['targets'] != 'use-v2' ) {
+ // Determine whether to enable NLS based on widget settings and the user's cookie.
+ $nls_enabled = $this->readCookie( $instance['nls_default'] );
+
+ $nls_link_toggle = $this->setToggleValue( $nls_enabled );
+
+ $nls_included = $instance['nls_included'];
+ if ( 'use' == $instance['targets'] ) {
// Render markup.
echo '';
echo '
'; // This closes the div#search-all.
};
if ( $instance['banner_text'] ) {
@@ -170,8 +104,8 @@ public function widget( $args, $instance ) {
echo '';
}
- if ( $instance['targets'] != 'use-v2' ) {
- echo '';
+ if ( 'use' == $instance['targets'] ) {
+ echo ''; // This closes the div#multisearch.
};
}
@@ -186,11 +120,7 @@ public function form( $instance ) {
$banner_text = $instance['banner_text'];
$targets = $instance['targets'];
if ( '' == $instance['targets'] ) {
- $targets = 'eds';
- }
- $bento_url = $instance['bento_url'];
- if ( '' == $instance['bento_url'] ) {
- $bento_url = 'https://lib.mit.edu/';
+ $targets = 'use-v2';
}
$nls_default = $instance['nls_default'];
if ( '' == $instance['nls_default'] ) {
@@ -211,36 +141,6 @@ class="widefat"
Which set of search targets should be shown?
-
-
-
-
- Natural language search
Should the natural language option be shown?