You are here

function webform_update_8160 in Webform 6.x

Same name and namespace in other branches
  1. 8.5 includes/webform.install.update.inc \webform_update_8160()

Issue #3019987: Fatal error: Allowed memory size after updating to rc29.

File

includes/webform.install.update.inc, line 3047
Archived Webform update hooks.

Code

function webform_update_8160() {
  $config = \Drupal::configFactory()
    ->getEditable('webform.webform.example_computed_elements');
  if (!$config) {
    return;
  }

  // Remove nested calculation elements.
  $elements = WebformYaml::decode($config
    ->get('elements'));
  if (isset($elements['calculation']) && isset($elements['calculation']['calculation'])) {
    $path = drupal_get_path('module', 'webform') . '/modules/webform_examples/config/install/webform.webform.example_computed_elements.yml';
    $data = Yaml::decode(file_get_contents($path));
    $config
      ->set('elements', $data['elements'])
      ->save();
  }
}