Commit ed4881f7 authored by Ivan Doroshenko's avatar Ivan Doroshenko Committed by Liam Morland
Browse files

ISTWCMS-4881: Only add CAPTCHA to empty Webforms

During migration, a new Webform may not be empty. Previously, migrated
Webforms would lose their elements.
parent ca7950c5
...@@ -133,7 +133,7 @@ function uw_sites_all_update_projects_alter(&$projects) { ...@@ -133,7 +133,7 @@ function uw_sites_all_update_projects_alter(&$projects) {
*/ */
function uw_sites_all_webform_presave(WebformInterface $webform): void { function uw_sites_all_webform_presave(WebformInterface $webform): void {
// Add a Webform CAPTCHA component to each newly-created Webform. // Add a Webform CAPTCHA component to each newly-created Webform.
if ($webform->isNew()) { if ($webform->isNew() && empty($webform->getElementsRaw())) {
$elements = [ $elements = [
'captcha' => [ 'captcha' => [
'#type' => 'captcha', '#type' => 'captcha',
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment