Skip to content

Commit

Permalink
make sure that default values are present
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcMichalsky committed Sep 6, 2023
1 parent da53351 commit 5c489b5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion CRM/Twingle/Form/Profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,10 @@ public function validate() {
*/
public function setDefaultValues() {
$defaults = parent::setDefaultValues();
if (in_array($this->_op, array('create', 'edit', 'copy'))) {
if (in_array($this->_op, ['create', 'edit', 'copy'])) {
if (!$this->profile) {
$this->profile = CRM_Twingle_Profile::createDefaultProfile()->copy();
}
$defaults['name'] = $this->profile->getName();
$profile_data = $this->profile->getData();
foreach ($profile_data as $element_name => $value) {
Expand Down

0 comments on commit 5c489b5

Please sign in to comment.