diff --git a/core/includes/form.inc b/core/includes/form.inc index e2e4dd2..e3ae228 100644 --- a/core/includes/form.inc +++ b/core/includes/form.inc @@ -530,11 +530,10 @@ function drupal_rebuild_form($form_id, &$form_state, $old_form = NULL) { * Fetches a form from the cache. */ function form_get_cache($form_build_id, &$form_state) { - if ($form = drupal_container()->get('keyvalue.expirable')->get('form')->get($form_build_id)) { + if ($form = Drupal::service('keyvalue.expirable')->get('form')->get($form_build_id)) { global $user; if ((isset($form['#cache_token']) && drupal_valid_token($form['#cache_token'])) || (!isset($form['#cache_token']) && !$user->uid)) { - $stored_form_state = drupal_container()->get('keyvalue.expirable')->get('form_state')->get($form_build_id); - if ($stored_form_state) { + if ($stored_form_state = Drupal::service('keyvalue.expirable')->get('form_state')->get($form_build_id)) { // Re-populate $form_state for subsequent rebuilds. $form_state = $stored_form_state + $form_state; @@ -568,12 +567,12 @@ function form_set_cache($form_build_id, $form, $form_state) { if ($GLOBALS['user']->uid) { $form['#cache_token'] = drupal_get_token(); } - drupal_container()->get('keyvalue.expirable')->get('form')->setWithExpire($form_build_id, $form, $expire); + Drupal::service('keyvalue.expirable')->get('form')->setWithExpire($form_build_id, $form, $expire); } // Cache form state. if ($data = array_diff_key($form_state, array_flip(form_state_keys_no_cache()))) { - drupal_container()->get('keyvalue.expirable')->get('form_state')->setWithExpire($form_build_id, $data, $expire); + Drupal::service('keyvalue.expirable')->get('form_state')->setWithExpire($form_build_id, $data, $expire); } } @@ -915,15 +914,6 @@ function drupal_process_form($form_id, &$form, &$form_state) { // Execute form submit handlers. form_execute_handlers('submit', $form, $form_state); - // We'll clear out the cached copies of the form and its stored data - // here, as we've finished with them. The in-memory copies are still - // here, though. - $config = config('system.performance'); - if (!$config->get('cache.page.use_internal') && !empty($form_state['values']['form_build_id'])) { - drupal_container()->get('keyvalue.expirable')->get('form')->delete($form_state['values']['form_build_id']); - drupal_container()->get('keyvalue.expirable')->get('form_state')->delete($form_state['values']['form_build_id']); - } - // If batches were set in the submit handlers, we process them now, // possibly ending execution. We make sure we do not react to the batch // that is already being processed (if a batch operation performs a