diff --git a/blockcache_alter.js b/blockcache_alter.js deleted file mode 100644 index 95246d0..0000000 --- a/blockcache_alter.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Check value of cache_block to see if - * we need to hide or show the additional settings. - */ -function BlockCacheAlterCheck() { - var blockcache = jQuery('#edit-cache-block'); - var selected = blockcache[0].options[blockcache[0].selectedIndex].value; - if (selected == '-1') { - toggleBlockCacheAlter('hide'); - } - else { - toggleBlockCacheAlter('show'); - } -} - -/** - * Show or hide additional blockcache settings. - */ -function toggleBlockCacheAlter(type) { - if (type == 'hide') { - jQuery('#blockcache_alter_wrapper').hide('slow'); - } - else { - jQuery('#blockcache_alter_wrapper').show('slow'); - } -} diff --git a/blockcache_alter.module b/blockcache_alter.module index 6097b45..04b53d6 100644 --- a/blockcache_alter.module +++ b/blockcache_alter.module @@ -45,21 +45,22 @@ function blockcache_alter_admin_settings() { '#title' => t('Show debug information ?'), '#description' => t('Debug info: shows helpful debugging whenever blocks are rendered, whether they are pulled form cache or not, and when block caches are refreshed.'), '#default_value' => variable_get('bca_debug', 0), + '#states' => array( + 'visible' => array(':input[name="bca_corepatch"]' => array('checked' => TRUE)), + ), ); $form['bca_user1'] = array( '#type' => 'checkbox', '#title' => t('Cache blocks for user 1 (uid 1) ?'), '#description' => t('This enables block caching for the primary Drupal user (uid 1). Can lead to unexpected results on production websites!'), '#default_value' => variable_get('bca_user1', 0), + '#states' => array( + 'visible' => array(':input[name="bca_corepatch"]' => array('checked' => TRUE)), + ), ); return system_settings_form($form); } -function blockcache_alter_init() { - // Add some funky hide and show javascript. - drupal_add_js(drupal_get_path('module', 'blockcache_alter') . '/blockcache_alter.js'); -} - /** * Implementation of hook_form_alter(). */ @@ -111,22 +112,19 @@ function blockcache_alter_form_alter(&$form, $form_state, $form_id) { '#description' => t('Select the appropriate cache setting for this block.'), '#options' => $block_cache_options, '#default_value' => $default_value, - '#attributes' => array('onChange' => 'javascript:BlockCacheAlterCheck(); return false;'), ); // Cache clearing option after saving this block. - $display = ($default_value == DRUPAL_NO_CACHE) ? 'none' : 'block'; $form['cache']['cache_block_clear'] = array( '#type' => 'radios', '#title' => t('Clear cache'), - '#prefix' => '