nliautaud / p01contact

Create contact forms by writing simple tags. Also a plugin for GetSimple and Pico CMS.
MIT License
16 stars 15 forks source link

Email fields and date customization #37

Closed ghost closed 5 years ago

ghost commented 5 years ago

Hi

how to delete this fields in the email ?

(text, Required) #0

(Required) #1

(textarea, Required) #3

can i change the date in the email like this ?

DD MM YY,HH:MM:SS instead of Fri, 05 Oct 2018 01:10:34 +0200

Where can i translate the fields in french in the mail ?

name, subject

thanks

nliautaud commented 5 years ago

Hi,

The date is passed to the mail template at the following location and use RFC 2822 format. You coud change the format to what you prefer. https://github.com/nliautaud/p01contact/blob/1876bc4eb29ba9848a49c89cb411d2796d73a136/p01-contact/src/P01contact_Form.php#L353

The ideal would be a general full-featured and localized format by default (pour avoir j/m/a en français par exemple), and in a second step maybe a config option to customize the format if needed. Feel free to make a PR if you can.


Every fields are shown in the mail by default. The fields are passed to the mail template at the following lines, you may want to condition that based on the field type for example. https://github.com/nliautaud/p01contact/blob/1876bc4eb29ba9848a49c89cb411d2796d73a136/p01-contact/src/P01contact_Form.php#L358-L359


The not translated fields is a bug. Could you test the patch #38 and report there for this subject ?

ghost commented 5 years ago

everything is ok except the elements in the mail that I can not remove (see photo attached) capture d ecran_2018-10-05_18-13-52

ghost commented 5 years ago

Hi I did not have any answers about my last request..

I would like to delete the texts circled in red and make sure that the captcha field does not appear in the mail.

thanks in advance

capture1

nliautaud commented 5 years ago

Hi !

For the captcha you should add a condition as indicated in my previous message. And as I said the mail are rendered in P01contact_Field::htmlMail. The info on the right is named properties here, so you probably want to comment the following lines :

https://github.com/nliautaud/p01contact/blob/1876bc4eb29ba9848a49c89cb411d2796d73a136/p01-contact/src/P01contact_Field.php#L297-L299

Note that ideally the mail templating would be fully templated trough Twig to allow a simpler mail customization, but that's not a common request for now. Would love a PR though.

ghost commented 5 years ago

J'ai résolu un des problèmes mais je n'arrive pas à supprimer le champ captcha..

capture d ecran_2018-10-29_20-28-49

nliautaud commented 5 years ago

Comme indiqué précédemment :

Every fields are shown in the mail by default. The fields are passed to the mail template at the following lines, you may want to condition that based on the field type for example. p01contact/p01-contact/src/P01contact_Form.php

Lines 358 to 359 in 1876bc4

     foreach ($this->fields as $field) { 
         $tpl_data->fields .= $field->htmlMail();

C'est à dire quelque chose comme :

foreach ($this->fields as $field) { 
    if ($field->type != 'captcha') {
        $tpl_data->fields .= $field->htmlMail();
    }

N'hésitez pas à créer une issue séparée pour une demande de feature de type "add an option to exclude fields by type in mail output" si ça vous semble pertinent.

ghost commented 5 years ago

it's so good !!!

Merci beaucoup !!!

Le recaptcha Google fonctionne a merveille en plus..

j'ai rajouté les lignes suivantes dans le style.ccs de votre plugin pour que le recaptcha soit responsive...

.g-recaptcha { transform:scale(0.90); -webkit-transform: scale(0.90); transform-origin:0 0; -webkit-transform-origin:0 0; } capture

le résultat final ici :+1 : https://www.mickaelbonnard.fr

nliautaud commented 5 years ago

Parfait 👍

Je n'inclue pas les hacks pour corriger les dimensions du recaptcha parce que les valeurs dépendent de chaque thème. Pensez néanmoins que vous pouvez inscrire votre règle dans une media query pour limiter son effet uniquement à la largeur d'écran appropriée.

@media screen and (max-width: 455px) {