- π¬π§United Kingdom catch
We did this (and related issues) instead: π ConfigFormBase + validation constraints: support composite form elements Needs review .
Follow-up to:
-
#1324618: Implement automated config saving for simple settings forms β
-
#1696224: Remove system_settings_form() β
-
#1653026: [META] Use properly typed values in module configuration β
Given:
system.performance.yml
config object containing (among other keys):cache:
page:
enabled: '0'
$form['caching']['cache'] = array(
'#type' => 'checkbox',
'#title' => t('Use internal page cache'),
'#description' => t("If a reverse proxy cache isn't available, use Drupal's internal cache system to store cached pages."),
'#default_value' => $config->get('cache.page.use_internal'),
);
Then:
- $form['caching']['cache'] = array(
+ $form['caching']['cache.page.enabled'] = array(
'#type' => 'checkbox',
'#title' => t('Use internal page cache'),
'#default_value' => $config->get('cache.page.enabled'),
'#weight' => -2,
);
public function submitForm(array &$form, array &$form_state) {
[...]
$this->config('system.performance')
- ->set('cache.page.use_internal', $form_state['values']['cache'])
+ ->set('cache.page.use_internal', $form_state['values']['cache.page.enabled'])
->set('cache.page.max_age', $form_state['values']['page_cache_maximum_age'])
enabled: '0'
Closed: outdated
9.5
Last updated
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
We did this (and related issues) instead: π ConfigFormBase + validation constraints: support composite form elements Needs review .