• I found this
    https://contactform7.com/2017/06/07/on-sent-ok-is-deprecated/

    It completely goes against
    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

    (@funsail)

    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

    (@funsail)

    Mr @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.