Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR fixes a regression issue that was introduced after we upgraded to a new CiviCRM version.
The Webform URL fields stopped showing and hiding when they were enabled or disabled for a particular case category.
Before
After
Technical Details
As pointed by @tunbola, this core PR made it possible to automatically append settings to the form without having to alter the template of the admin.
The upgrade of CiviCRM version also updated the admin settings page, and the path that we were relying on was updated and we were not able to add the manual fields and the script needed to hide and show them. This is the only reason why the fields were not duplicated.
To take advantage of the new behaviour introduced by core and to fix the issue, the following changes have been made:
alterContent
hook to add custom fields. We don't need to alter the form in order to display our custom fields and this is unreliable in case the form's HTML structure changed.CRM/Civicase/Service/CaseCategorySetting.php
) and we use this information to toggle the visibility of the corresponding field.CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME
data to each one of the custom fields we are appending. Instead of adding a new line each time we create a new field we have made it so that the list of settings is read from thesettings/CiviCase.setting.php
and for each one of them we add this required value.