Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Add a new selection box,"prevent back top top displayed 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));
Comment | File | Size | Author |
---|---|---|---|
Selection_001.png | 19.83 KB | deapge | |
patch.diff | 1.31 KB | deapge |
Comments
Comment #1
acke CreditAttribution: acke commentedHm - 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".
Comment #1.0
acke CreditAttribution: acke commentedadd patch code
Comment #2
acke CreditAttribution: acke commentedI 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.