diff -u b/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc --- b/core/modules/system/system.admin.inc +++ b/core/modules/system/system.admin.inc @@ -1679,25 +1679,28 @@ '#title' => t('Caching'), ); - $form['caching']['cache'] = config_form_element($form, $form_state, $config, 'cache', array( + $form['caching']['cache'] = array( '#type' => 'checkbox', '#title' => t('Cache pages for anonymous users'), + '#config' => 'system.performance:cache', '#weight' => -2, - )); + ); $period = drupal_map_assoc(array(0, 60, 180, 300, 600, 900, 1800, 2700, 3600, 10800, 21600, 32400, 43200, 86400), 'format_interval'); $period[0] = '<' . t('none') . '>'; - $form['caching']['cache_lifetime'] = config_form_element($form, $form_state, $config, 'cache_lifetime', array( + $form['caching']['cache_lifetime'] = array( '#type' => 'select', '#title' => t('Minimum cache lifetime'), + '#config' => 'system.performance:cache_lifetime', '#options' => $period, '#description' => t('Cached pages will not be re-created until at least this much time has elapsed.'), - )); - $form['caching']['page_cache_maximum_age'] = config_form_element($form, $form_state, $config, 'page_cache_maximum_age', array( + ); + $form['caching']['page_cache_maximum_age'] = array( '#type' => 'select', '#title' => t('Expiration of cached pages'), + '#config' => 'system.performance:page_cache_maximum_age', '#options' => $period, '#description' => t('The maximum time an external cache can use an old version of a page.'), - )); + ); $directory = 'public://'; $is_writable = is_dir($directory) && is_writable($directory); @@ -1714,22 +1717,25 @@ ); $js_hide = $config->get('cache') ? '' : ' class="js-hide"'; - $form['bandwidth_optimization']['page_compression'] = config_form_element($form, $form_state, $config, 'page_compression', array( + $form['bandwidth_optimization']['page_compression'] = array( '#type' => 'checkbox', '#title' => t('Compress cached pages.'), + '#config' => 'system.performance:page_compression', '#prefix' => '
', '#suffix' => '
', - )); - $form['bandwidth_optimization']['preprocess_css'] = config_form_element($form, $form_state, $config, 'preprocess_css', array( + ); + $form['bandwidth_optimization']['preprocess_css'] = array( '#type' => 'checkbox', '#title' => t('Aggregate and compress CSS files.'), + '#config' => 'system.performance:preprocess_css', '#disabled' => $disabled, - )); - $form['bandwidth_optimization']['preprocess_js'] = config_form_element($form, $form_state, $config, 'preprocess_js', array( + ); + $form['bandwidth_optimization']['preprocess_js'] = array( '#type' => 'checkbox', '#title' => t('Aggregate JavaScript files.'), + '#config' => 'system.performance:preprocess_js', '#disabled' => $disabled, - )); + ); $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array( only in patch2: unchanged: --- a/core/includes/form.inc +++ b/core/includes/form.inc @@ -1759,6 +1759,9 @@ function form_builder($form_id, &$element, &$form_state) { '#title_display' => 'before', ); + // Allow modules to alter elements prior to building/processing them. + drupal_alter('form_element', $element, $form_state); + // Special handling if we're on the top level form element. if (isset($element['#type']) && $element['#type'] == 'form') { if (!empty($element['#https']) && variable_get('https', FALSE) && only in patch2: unchanged: --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -4069,3 +4069,13 @@ function country_get_list() { drupal_alter('countries', $countries); return $countries; } + +/** + * @todo Move to config.module when system.module is able to have dependencies. + */ +function system_form_element_alter(&$element, &$form_state) { + if (isset($element['#config'])) { + list($config_name, $config_key) = explode(':', $element['#config']); + $element = config_form_element($form_state['complete_form'], $form_state, config($config_name), $config_key, $element); + } +}