Add a new selection box,"prevent back top top displayed on front pages."
Prevent on front pages

Index: back_to_top.admin.inc
===================================================================
--- back_to_top.admin.inc	(revision 4189)
+++ back_to_top.admin.inc	(working copy)
@@ -25,6 +25,12 @@
     '#description' => t('Do you want to prevent Back To Top on admin pages?'),
     '#default_value' => variable_get('back_to_top_prevent_in_admin', TRUE),
   );
+  $form['back_to_top_prevent_in_front'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Prevent on front pages'),
+    '#description' => t('Do you want to prevent Back To Top on front pages?'),
+    '#default_value' => variable_get('back_to_top_prevent_in_front', TRUE),
+  );
   $form['back_to_top_button_trigger'] = array(
     '#type' => 'textfield',
     '#title' => t('Trigger'),
Index: back_to_top.module
===================================================================
--- back_to_top.module	(revision 4189)
+++ back_to_top.module	(working copy)
@@ -41,6 +41,9 @@
   if (variable_get('back_to_top_prevent_in_admin', 'TRUE') && (is_adminpage())) {
     return FALSE;
   }
+  if (variable_get('back_to_top_prevent_in_front', 'TRUE') && (!is_adminpage())) {
+    return FALSE;
+  }
   drupal_add_library('system', 'effects');
   drupal_add_js(drupal_get_path('module', 'back_to_top') . '/js/back_to_top.js', array('group' => JS_DEFAULT, 'every_page' => TRUE));
   
CommentFileSizeAuthor
Selection_001.png19.83 KBdeapge
patch.diff1.31 KBdeapge
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

acke’s picture

Status: Patch (to be ported) » Needs work

Hm - so the use case for this is to use back to top only on admin pages? Prevent on front pages sound to me more like "Prevent on front page" - the front page of the site. I would call this "Use only on admin pages" and "Do you want to use Back To Top only on the admin pages?". The variable could be called "back_to_top_use_only_on_admin_pages".

acke’s picture

Issue summary: View changes

add patch code

acke’s picture

Issue summary: View changes
Status: Needs work » Fixed

I changed so it's really Prevent Back To Top on front page using the drupal_is_front_page function. Committed and push to HEAD/7.x-1.x and going into 1.4.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.