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

[REF] dev/core#2790 towards pdf task trait #21276

Merged
merged 1 commit into from
Aug 31, 2021

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented Aug 27, 2021

Overview

Deprecate CRM_Activity_Form_Task_PDFLetterCommon

https://lab.civicrm.org/dev/core/-/issues/2790

Before

3 classes in play to render the activity pdf form - as a quasi OO

After

Down to 2

Technical Details

This gets us to having 2 classes rather than 3 that manage the activityPDF task
functionality.

CRM_Activity_Form_Task_PDFLetterCommon doesn't really add anything from a structure POV
but it does make it more confusing. There are also functions on the parent
that are only used by this class - which makes switching to a trait
harder. This untangles that part.

Note that once we have the trait (& some more token cleanup done) we will be well placed
to share some of these functions so that they are actually used by more than one class

Comments

@civibot
Copy link

civibot bot commented Aug 27, 2021

(Standard links)

@civibot civibot bot added the master label Aug 27, 2021
@eileenmcnaughton
Copy link
Contributor Author

test this please

@demeritcowboy
Copy link
Contributor

Ah sorry now this has conflicts.

@eileenmcnaughton
Copy link
Contributor Author

thanks @demeritcowboy - I've updated it

@demeritcowboy
Copy link
Contributor

Is conflicted again - 21290

@eileenmcnaughton eileenmcnaughton force-pushed the pdf branch 2 times, most recently from 99e4e87 to 22cf409 Compare August 28, 2021 22:37
@eileenmcnaughton
Copy link
Contributor Author

@demeritcowboy rebased again!

@eileenmcnaughton
Copy link
Contributor Author

& conflicted again - but I just rebased

@@ -31,18 +33,24 @@ public function preProcess() {
*/
public function buildQuickForm() {
$this->addPDFElementsToForm();
// Remove types other than pdf as they are not working (have never worked) and don't want fix
// for them to block pdf.
Copy link
Contributor

Choose a reason for hiding this comment

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

So far so good just this seems like a useful comment? Otherwise it's not clear why this override is here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@demeritcowboy good catch - I had wondered why that line was there, not realising I had removed the explanation - back now

Deprecate CRM_Activity_Form_Task_PDFLetterCommon

This gets us to having 2 classes rather than 3 that manage the activityPDF task
functionality.

CRM_Activity_Form_Task_PDFLetterCommon doesn't really add anything from a structure POV
but it does make it more confusing. There are also functions on the parent
that are only used by this class - which makes switching to a trait
harder. This untangles that part.

Note that once we have the trait (& some more token cleanup done) we will be well placed
to re-share some of these functions again
*/
public function createTokenProcessor() {
return new TokenProcessor(\Civi::dispatcher(), [
'controller' => get_class(),
Copy link
Contributor

Choose a reason for hiding this comment

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

get_class() here is a different class than before the patch, but it doesn't seem to make a difference on the activity print/merge. When I look around the token classes for "controller", I only really see it in hook_tokenValues. I don't see any hook implementations in universe that depend specifically on CRM_Activity_Form_Task_PDFLetterCommon.

@demeritcowboy demeritcowboy merged commit c15d7fd into civicrm:master Aug 31, 2021
@eileenmcnaughton eileenmcnaughton deleted the pdf branch August 31, 2021 19:03
@eileenmcnaughton
Copy link
Contributor Author

thanks @demeritcowboy

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