You are here

function webform_update_8027 in Webform 6.x

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

Issue #2857417: Add support for open and close date/time to Webform nodes. Update field config settings.

File

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

Code

function webform_update_8027() {
  $field_configs = \Drupal::entityTypeManager()
    ->getStorage('field_config')
    ->loadByProperties([
    'field_type' => 'webform',
  ]);
  foreach ($field_configs as $field) {
    $field
      ->setSetting('status', $field
      ->getSetting('status') ? WebformInterface::STATUS_OPEN : WebformInterface::STATUS_CLOSED);
    $field
      ->setSetting('open', '');
    $field
      ->setSetting('close', '');
    $field
      ->save();
  }
}