Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev/core#1663 - Fix warning on relationship form #16845

Merged
merged 1 commit into from
Mar 26, 2020

Conversation

jitendrapurohit
Copy link
Contributor

Overview

PHP warning display on add relationship form.

Before

To replicate - simply open a relationship form on a new window.

image

After

No warnings displayed.

Technical Details

Seems option_context was added in https://github.com/civicrm/civicrm-core/pull/11853/files#diff-f9397c2b103c68ffb588679b5d4784a2. As we're only interested in adding the json string to it later in the code, this PR change avoids the array value to be added while creating the element.

I'm not sure why we can't simply add data-option-edit-context json attribute in the relationship form itself? thoughts @mickadoo @colemanw ?

Comments

Gitlab - https://lab.civicrm.org/dev/core/issues/1663

@civibot
Copy link

civibot bot commented Mar 19, 2020

(Standard links)

@civibot civibot bot added the master label Mar 19, 2020
@@ -413,6 +413,9 @@ public function &add(
}
}
}
$optionContext = $extra['option_context'] ?? NULL;
unset($extra['option_context']);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jitendrapurohit why are we unsetting $extra['option_context'] ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yashodha option_context is in array format which is causing all the problems here. The main aim of this code seems to assign data-option-edit-context in the json format. This is done in the later part of the code. This PR avoids $element to have an unnecessary array attribute option_context which leads to the warning message on the relationship form.

@yashodha
Copy link
Contributor

@jitendrapurohit merging this PR

@yashodha yashodha merged commit 133a745 into civicrm:master Mar 26, 2020
@jitendrapurohit jitendrapurohit deleted the core-1663 branch April 1, 2020 10:42
jitendrapurohit pushed a commit to jitendrapurohit/civicrm-core that referenced this pull request Apr 1, 2020
eileenmcnaughton added a commit that referenced this pull request Apr 1, 2020
Follow up PR for #16845 - Fix form error when  variable is NULL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants