function authcache_form_system_performance_settings_alter in Authenticated User Page Caching (Authcache) 7.2
Implements hook_form_FORM_ID_alter().
Related topics
File
- ./
authcache.module, line 283 - Authenticated User Page Caching (and anonymous users, too!)
Code
function authcache_form_system_performance_settings_alter(&$form, &$form_state) {
$roles = authcache_get_roles();
if (count($roles)) {
$message = '<p>' . t('Drupal core page caching for anonymous users does not work properly when Authcache is enabled. Please either deactivate Drupal core page caching or disable Authcache.') . '</p>';
if (!isset($roles[DRUPAL_ANONYMOUS_RID])) {
$message .= '<p>' . t('You may enable the page cache for anonymous users by <a href="!link">configuring</a> Authcache for anonymous users', array(
'!link' => url('admin/config/system/authcache'),
)) . '</p>';
}
if (variable_get('page_cache_without_database')) {
$message .= '<p>' . t('Furthermore it seems that !setting is enabled. Please remove that line from !file, otherwise Authcache will not work properly.', array(
'!setting' => '<code>$conf[\'page_cache_without_database\']</code>',
'!file' => '<code>' . conf_path() . '/settings.php</code>',
)) . '</p>';
}
$form['caching']['authcache-warning'] = array(
'#type' => 'container',
'#attributes' => array(
'class' => array(
'messages',
'warning',
),
),
'message' => array(
'#markup' => $message,
),
'#weight' => -3,
);
// If $conf['page_cache_without_database'] is set in settings.php, the
// warning will be shown regardless of the value of $conf['cache'].
// Otherwise states are used to show/hide the warning if appropriate.
if (!variable_get('page_cache_without_database')) {
$form['caching']['authcache-warning']['#states'] = array(
'visible' => array(
':input[name=cache]' => array(
'checked' => TRUE,
),
),
);
}
// Disable hiding of compression check-box
unset($form['bandwidth_optimization']['page_compression']['#prefix']);
unset($form['bandwidth_optimization']['page_compression']['#suffix']);
}
}