Title: Encapsulation &#8211; computer_programming
Last modified: August 27, 2017

---

# Encapsulation – computer_programming

 *  [funsail](https://wordpress.org/support/users/funsail/)
 * (@funsail)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/encapsulation-computer_programming/)
 * I found this
    [https://contactform7.com/2017/06/07/on-sent-ok-is-deprecated/](https://contactform7.com/2017/06/07/on-sent-ok-is-deprecated/)
 * It completely goes against
    [https://en.wikipedia.org/wiki/Encapsulation_(computer_programming)](https://en.wikipedia.org/wiki/Encapsulation_(computer_programming))
 * I’m trying hard to imagine why each time I add a new form I’d need to change 
   a php file as well. Or if I copy a form to another site I have to remember there’s
   a line in a php somewhere.
 * Imagine the code on a site
 *     ```
       document.addEventListener( 'wpcf7mailsent', function( event ) {
           if ( '123' == event.detail.contactFormId ) {
               ga( 'send', 'event', 'Contact Form', 'submit' );
           }
           if ( '432' == event.detail.contactFormId ) {
               ga( 'send', 'event', 'Something else', 'submit' );
           }
           if ( '634' == event.detail.contactFormId ) {
               "location = '/redirect2/';"
               do(something);
           }
           if ( '24' == event.detail.contactFormId ) {
               "location = '/redirect1/';"
           }
           if ( '452' == event.detail.contactFormId ) {
               fbq('track', 'Lead', 'hslo');
           }
       }, false );
       ```
   
 * Oh I need to change the “haircut” form to do this. Oh which id is it? Where is
   it in the code?
 * What if you use this theme for (gasp) TWO+ sites? What if they have the same 
   id? What if I’m trying to find which form ‘452’ is and now I’ll need to open 
   10 forms on 3 sites and see which has the id?
 * It is very strange you have chosen to do this. Next would you do the same to 
   the ‘mail’ tab? And we’ll have a huge function to do mailing? No, it would make
   no sense. This makes no sense.
 * functions.php is NOT meant for site specific code. I’m not going to litter my
   site with dirty code like this. There has to be a better way.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [funsail](https://wordpress.org/support/users/funsail/)
 * (@funsail)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/encapsulation-computer_programming/#post-9610612)
 * I’m not sure why I’m being ignored. I’m either wrong and you’re not proposing
   everyone have to hack the functions.php to make a plugin work,
    or I haven’t 
   misinterpreted and this is a stupid idea.
 *  Thread Starter [funsail](https://wordpress.org/support/users/funsail/)
 * (@funsail)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/encapsulation-computer_programming/#post-9807926)
 * Mr [@takayukister](https://wordpress.org/support/users/takayukister/) I’m either
   right or wrong.
 * If I’m wrong, tell me why I don’t understand.
 * If I’m right, tell me why you don’t care.
 * 返事ぐらいしてください。礼儀だろう？

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Encapsulation – computer_programming’ is closed to new replies.

 * ![](https://ps.w.org/contact-form-7/assets/icon.svg?rev=2339255)
 * [Contact Form 7](https://wordpress.org/plugins/contact-form-7/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/contact-form-7/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/contact-form-7/)
 * [Active Topics](https://wordpress.org/support/plugin/contact-form-7/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/contact-form-7/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/contact-form-7/reviews/)

## Tags

 * [events](https://wordpress.org/support/topic-tag/events/)
 * [send](https://wordpress.org/support/topic-tag/send/)

 * 2 replies
 * 1 participant
 * Last reply from: [funsail](https://wordpress.org/support/users/funsail/)
 * Last activity: [8 years, 4 months ago](https://wordpress.org/support/topic/encapsulation-computer_programming/#post-9807926)
 * Status: not resolved