-
-
Notifications
You must be signed in to change notification settings - Fork 827
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
Add a "report output handler", so that we can start untangling the PDF, CSV #17145
Conversation
…DF, CSV and email code, and allow extensions to implement their own methods (ex: Excel Export).
(Standard links)
|
I haven't tested this & it seems not quite review-ready (style, tests) but I agree with the approach & can't see any cause for concern in the code I wrestled emotionally with this
But I guess it's OK. The only alternative I can think of is some kind of array with pdf to class - which has i's own drawbacks I guess. It does feel a bi civi-4.x - perhaps @totten has thoughts |
I noticed the same block of code too. There's often a preference for dependency-injection instead, where you ask for the class from the container. The advantage is that people can override the implementation of e.g. the So my two cents is at least separate that e.g.
Others may have more opinions, or what might mesh better with civi. |
Interesting - thanks for the feedback! Just to double-check: would it make sense to create it under
.. which would then wrap the code to create the new class, and later on we can make it configurable? The closest example I found was /Civi/Core/Themes.php, which has the "themes" hook? and should I place the code under Civi? or is that more kept for services, and in this case, the difference betwen CRM and Civi is mostly a question of coding style? |
I think above seems about right - I'd really like @totten to comment. |
Jenkins re test this please |
Closing in favour of #17693 |
.. and email code, and allow extensions to implement their own methods (ex: Excel
Export).
Overview
Early attempt at untangling the Report code, so that it can be more easily pluggable.
Context: the "Export to Excel" extension (which has a fairly large user-base) requires a patch on core so that all reports export correctly:
https://lab.civicrm.org/extensions/civiexportexcel/-/blob/master/civiexportexcel-core.patch
As you can see, it really doesn't take much to make report export pluggable. Extensions can already add custom actions, but they can't influence the "outputMode".
I would appreciate feedback since:
Ideally, I would like to start small, then implement this in the Export to Excel extension, iterate a bit (figure out if more methods should be added for other use-cases, then write good documentation.
Before
Impossible to export into anything else than CSV or PDF.
After
Extension authors can provide custom actions.