You are here

function webform_update_8096 in Webform 6.x

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

Issue #2931888: Add a boolean flag 'use as likert' for options list and remove the machine name pattern matching in likert element.

File

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

Code

function webform_update_8096() {
  $config_factory = \Drupal::configFactory();
  foreach ($config_factory
    ->listAll('webform.webform_options.') as $config_name) {
    $config = $config_factory
      ->getEditable($config_name);
    $data = $config
      ->getRawData();
    $likert = strpos($data['id'], 'likert_') === 0 ? TRUE : FALSE;
    WebformArrayHelper::insertAfter($data, 'category', 'likert', $likert);
    $config
      ->setData($data);
    $config
      ->save(TRUE);
  }
}