-
-
Notifications
You must be signed in to change notification settings - Fork 814
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#964 Add start date and end date values on page contribution widget ajax response #14262
Conversation
(Standard links)
|
CRM/Contribute/BAO/Widget.php
Outdated
@@ -127,6 +127,8 @@ public static function getContributionPageData($contributionPageID, $widgetID, $ | |||
$now = time(); | |||
if ($dao->start_date) { | |||
$startDate = CRM_Utils_Date::unixTime($dao->start_date); | |||
$data['stard_date'] = $startDate; |
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.
typo here in the word "stard"
I think it would be more consistent with everything else in civi if you return the ISO format for Also I'm not wild about the "time to start" and "time to end" since that's generally something that should be calculated & updated in real-time by javascript. As soon as you fetch this data it will be outdated, moreso if any kind of caching is used. |
@colemanw, I agree with your comments, I have already applied the changes. If you do it for good, I will change the description of the PR according to the changes. Thanks! |
Ok this looks useful and harmless as it's just adding a couple other bits of data to an ajax response. |
Thanks @colemanw |
Overview
Contribution page widgets calls civicrm/extern/widget.php to extract info of the campaign related to the widget. In some cases it maybe interesting to have the time to start or to finish the campaign to customize the widget with options such as "Starts in X days", "Ends in X days" or anything else.
in the line of https://issues.civicrm.org/jira/browse/CRM-21454
Before
After
Json response includes "start_date":YYYY-MM-DD hh:mm:ss,"time_to_end":YYYY-MM-DD hh:mm:ss if start date and end date are defined respectively.
Comments
An example of how to take advantage of these new fields:
"start_date" and "end_date" values also allows customize predefined "campaign_start" messages ('Campaign starts on %1', 'Campaign ended on %1', etc.)