diff --git a/modules/block/block.admin.inc b/modules/block/block.admin.inc index a0ecb48df1c320ab8423966758e2398d7bcd7cc8..c0f3c4789425978df63360de8e9455c3d8568cc3 100644 --- a/modules/block/block.admin.inc +++ b/modules/block/block.admin.inc @@ -6,30 +6,6 @@ * Admin page callbacks for the block module. */ -/** - * Implement hook_form_FORM_ID_alter(). - */ -function block_form_system_performance_settings_alter(&$form, &$form_state) { - $disabled = count(module_implements('node_grants')); - $form['caching']['block_cache'] = array( - '#type' => 'checkbox', - '#title' => t('Cache blocks'), - '#default_value' => variable_get('block_cache', FALSE), - '#disabled' => $disabled, - '#description' => $disabled ? t('Block caching is inactive because you have enabled modules defining content access restrictions.') : NULL, - '#weight' => -1, - ); - - // Check if the "Who's online" block is enabled. - $online_block_enabled = db_query_range("SELECT 1 FROM {block} b WHERE module = 'user' AND delta = 'online' AND status = 1", array(), 0, 1)->fetchField(); - - // If the "Who's online" block is enabled, append some descriptive text to - // the end of the form description. - if ($online_block_enabled) { - $form['page_cache']['cache']['#description'] .= '<p>' . t('When caching is enabled, anonymous user sessions are only saved to the database when needed, so the "Who\'s online" block does not display the number of anonymous users.') . '</p>'; - } -} - /** * Menu callback for admin/structure/block. */ diff --git a/modules/block/block.module b/modules/block/block.module index 55f34ac2b08add8306d6ac1148fad59ea6a4f934..e12b06a66496fe12dbfe20818d1bb4dec9a41d73 100644 --- a/modules/block/block.module +++ b/modules/block/block.module @@ -805,3 +805,26 @@ function block_filter_format_delete($format, $default) { ->execute(); } +/** + * Implement hook_form_FORM_ID_alter(). + */ +function block_form_system_performance_settings_alter(&$form, &$form_state) { + $disabled = count(module_implements('node_grants')); + $form['caching']['block_cache'] = array( + '#type' => 'checkbox', + '#title' => t('Cache blocks'), + '#default_value' => variable_get('block_cache', FALSE), + '#disabled' => $disabled, + '#description' => $disabled ? t('Block caching is inactive because you have enabled modules defining content access restrictions.') : NULL, + '#weight' => -1, + ); + + // Check if the "Who's online" block is enabled. + $online_block_enabled = db_query_range("SELECT 1 FROM {block} b WHERE module = 'user' AND delta = 'online' AND status = 1", array(), 0, 1)->fetchField(); + + // If the "Who's online" block is enabled, append some descriptive text to + // the end of the form description. + if ($online_block_enabled) { + $form['page_cache']['cache']['#description'] .= '<p>' . t('When caching is enabled, anonymous user sessions are only saved to the database when needed, so the "Who\'s online" block does not display the number of anonymous users.') . '</p>'; + } +}