-
-
Notifications
You must be signed in to change notification settings - Fork 825
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
Allow descriptions for payment fields #12721
Allow descriptions for payment fields #12721
Conversation
(Standard links)
|
Applied as patch to 5.4.0, working well here with current org.civicrm.smartdebit master, thanks! Edit: Have tested successfully both on contribution page & with Webform CiviCRM. |
@KarinG Is this something that could be of interest to you at all? That you might have time to review :-) Works on webform as well. |
templates/CRM/Core/BillingBlock.tpl
Outdated
@@ -41,7 +41,8 @@ | |||
</div> | |||
<div class="content"> | |||
{$form.$paymentField.html} | |||
{if $paymentField == 'cvv2'}{* @todo move to form assignment*} | |||
{if $paymentFieldDescriptions.$name}<div class="description">{$paymentFieldDescriptions.$name}</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mattwire Can you move the div section next line for better styling?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pradpnayak Yes, I've changed it - is that ok?
8b27615
to
f44a7b1
Compare
CRM/Custom/Form/Field.php
Outdated
'return' => ['title'], | ||
]; | ||
} | ||
|
||
// Get all custom (is_reserved=0) option groups |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this change required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, extra commit sneaked in
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think they are back again ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gone again..
CRM/Core/Payment/Form.php
Outdated
@@ -129,8 +129,10 @@ protected static function addCommonFields(&$form, $paymentFields) { | |||
// This will cause the fields to be marked as required - but it is up to the payment processor to | |||
// validate it. | |||
$requiredPaymentFields[$field['name']] = $field['is_required']; | |||
$paymentFieldDescriptions[$field['name']] = $field['description']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we change this to
if (!empty($field['description'])) {
$paymentFieldDescriptions[$field['name']] = $field['description'];
}
I feel there will be notice error when description is not present in $field.
9274a54
to
23ee3db
Compare
23ee3db
to
6f91492
Compare
@mattwire this makes sense but I think we should assign the paymentfield metadata array to the template rather than an array specific to descriptions. Otherwise next time we want some extra info we have to define a new assign |
6f91492
to
4533376
Compare
@pradpnayak @eileenmcnaughton This is now updated per comments |
retest this please |
Code looks good. Thanks @pradpnayak for testing. Merge on pass |
test this please |
test fails unrelated |
Overview
Allow a description to be specified for payment form fields.
Before
It is not possible to add a description for any of the payment fields.
After
A description can be added for any field added by
getPaymentFormFieldsMetadata()
Technical Details
This adds an array of descriptions that is assigned to the template and can be used to display descriptions for each form element. If the description is not specified there is no change.
Comments
Example usage in org.civicrm.smartdebit here: mattwire/org.civicrm.smartdebit@931fbaf