From 6e5cba54f19f099b8a62e1a440e33ad367548a2d Mon Sep 17 00:00:00 2001 From: Jitendra Purohit Date: Thu, 19 Mar 2020 12:27:48 +0530 Subject: [PATCH] dev/core#1663 - Fix warning on relationship form --- CRM/Core/Form.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/CRM/Core/Form.php b/CRM/Core/Form.php index d5fdbb7f0f..9ac4031387 100644 --- a/CRM/Core/Form.php +++ b/CRM/Core/Form.php @@ -413,6 +413,9 @@ class CRM_Core_Form extends HTML_QuickForm_Page { } } } + $optionContext = $extra['option_context'] ?? NULL; + unset($extra['option_context']); + $element = $this->addElement($type, $name, $label, $attributes, $extra); if (HTML_QuickForm::isError($element)) { CRM_Core_Error::fatal(HTML_QuickForm::errorMessage($element)); @@ -435,9 +438,8 @@ class CRM_Core_Form extends HTML_QuickForm_Page { } // Add context for the editing of option groups - if (isset($extra['option_context'])) { - $context = json_encode($extra['option_context']); - $element->setAttribute('data-option-edit-context', $context); + if ($optionContext) { + $element->setAttribute('data-option-edit-context', json_encode($optionContext)); } return $element; -- 2.25.1