-
Notifications
You must be signed in to change notification settings - Fork 194
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
Feature: Add Campaign Donations block #7703
base: feature/campaign-donors-block
Are you sure you want to change the base?
Feature: Add Campaign Donations block #7703
Conversation
/** | ||
* @unreleased | ||
*/ | ||
private function renderBlockHtml($donations): void |
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.
Oh man, I'm having a hard time reading this 😅
Why don't you move this into a separate file and then use the View
class to load and render the file?
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.
This is a very WP way of doing these things and I have to say that I'm not a big fan 😁
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.
Really? I even tried to make it more object oriented, moving away from WP way of doing it.
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.
Let's discuss this more.
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.
Yeah, I don't like to mix PHP and HTML. I would love to see HTML in a separate file, and then you load it with the View
helper class.
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.
Jon would like to see the template as being a React app.
/** | ||
* @unreleased | ||
*/ | ||
if ( ! class_exists(CampaignDonationsBlockRenderer::class)) { |
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.
Why do we have to check if the class exists?
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.
Honestly, I didn't go much further on that but when in the Page Editor, I was receiving a fatal error from the block renderer saying that class was being registered multiple times.
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.
This is because the CampaignDonationsBlockRenderer
is defined in the render.php file, and this file is included each time you include this block. The solution would be to move the class definition outside the render.php
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.
Refactored on 9392c10
90390f7
to
4977ca5
Compare
Resolves GIVE-1393
Description
This pull request adds the Campaign Donations block, with options to show the top donations (by amount) or the recent donation (by date). This block is like a copy of the Campaign Donors block with some slightly changes on the visual but mainly in its query.
Visuals
Block Settings
Top donations and Recent donations
Empty state
Pre-review Checklist
@unreleased
tags included in DocBlocks