diff --git a/core/lib/Drupal/Core/Form/FormBuilder.php b/core/lib/Drupal/Core/Form/FormBuilder.php index 43d15a6..70c8415 100644 --- a/core/lib/Drupal/Core/Form/FormBuilder.php +++ b/core/lib/Drupal/Core/Form/FormBuilder.php @@ -390,9 +390,7 @@ public function getCache($form_build_id, &$form_state) { * {@inheritdoc} */ public function setCache($form_build_id, $form, $form_state) { - // 6 hours cache life time for forms should be plenty. - $expire = 21600; - + $expire = \Drupal::config('system.form')->get('cache_expire'); // Cache form structure. if (isset($form)) { if ($this->currentUser()->isAuthenticated()) { diff --git a/core/modules/system/config/system.form.yml b/core/modules/system/config/system.form.yml new file mode 100644 index 0000000..5e7a519 --- /dev/null +++ b/core/modules/system/config/system.form.yml @@ -0,0 +1 @@ +cache_expire: '21600' diff --git a/core/modules/system/lib/Drupal/system/Tests/Form/FormCacheTest.php b/core/modules/system/lib/Drupal/system/Tests/Form/FormCacheTest.php index 0e6d629..bf9ee3e 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Form/FormCacheTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Form/FormCacheTest.php @@ -34,6 +34,9 @@ public function setUp() { parent::setUp(); $this->installSchema('system', array('key_value_expire')); + // Only a minimal config is loaded, so set cache timeout explicitly. + \Drupal::config('system.form')->set('cache_expire', 21600)->save(); + $this->form_build_id = $this->randomName(); $this->form = array( '#property' => $this->randomName(),