function yamlform_update_8062 in YAML Form 8
Issue #2820844: Change yamlform.setting.element.types to yamlform.setting.element.excluded.types.
File
- includes/
yamlform.update.inc, line 1235 - YAML Form module update hooks.
Code
function yamlform_update_8062() {
$settings_config = \Drupal::configFactory()
->getEditable('yamlform.settings');
/** @var \Drupal\yamlform\YamlFormElementManagerInterface $element_manager */
$element_manager = \Drupal::service('plugin.manager.yamlform.element');
$element_plugins = $element_manager
->getInstances();
$element_types = [];
foreach ($element_plugins as $element_id => $element_plugin) {
$element_types[$element_id] = $element_id;
}
ksort($element_types);
$included_types = $settings_config
->get('elements.types');
$excluded_types = array_diff($element_types, $included_types);
$settings_config
->set('elements.excluded_types', $excluded_types);
$settings_config
->clear('elements.types');
$settings_config
->save();
}