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] Move generic preProcess function to the trait #16954

Merged
merged 1 commit into from
Apr 8, 2020

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented Apr 2, 2020

Overview

Code consolidation on forms to send emails - no change to functionality

Before

PreProcess function duplicated

After

Shared function on the shared trait

Technical Details

Note this is overriden on the contact email form

Comments

This is still overriden on the contact email.
@civibot
Copy link

civibot bot commented Apr 2, 2020

(Standard links)

@eileenmcnaughton
Copy link
Contributor Author

@colemanw can you also check this - this is the trait I'm cleaning up to use the entity reference

@totten
Copy link
Member

totten commented Apr 8, 2020

FWIW, grepping on where the trait is used finds:

(1) CRM/Activity/Form/Task/Email.php:  use CRM_Contact_Form_Task_EmailTrait;
(2) CRM/Contact/Form/Task/Email.php:  use CRM_Contact_Form_Task_EmailTrait;
(3) CRM/Contribute/Form/Task/Email.php:  use CRM_Contact_Form_Task_EmailTrait;
(4) CRM/Event/Form/Task/Email.php:  use CRM_Contact_Form_Task_EmailTrait;
(5) CRM/Member/Form/Task/Email.php:  use CRM_Contact_Form_Task_EmailTrait;

This PR removes identical preProcess() functions from all the consumers except (2). Item (2) already has a rather different implementation of preProcess(). However, my understanding of this situation is that CRM/Contact/Form/Task/Email.php would continue to use its own variant of preProcess().

@eileenmcnaughton
Copy link
Contributor Author

@totten - yep it does

@colemanw
Copy link
Member

colemanw commented Apr 8, 2020

Makes sense.

@colemanw colemanw merged commit 7a4a808 into civicrm:master Apr 8, 2020
@colemanw colemanw deleted the email4 branch April 8, 2020 12:02
@colemanw
Copy link
Member

colemanw commented Apr 8, 2020

I double checked the php traits docs just to make sure. The Example # 3 Alternate Precedence Order Example shows that a method declared in a class using a trait overrides the same method from the trait.

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.

3 participants