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

Email fields and date customization #37

Closed
ghost opened this issue Oct 4, 2018 · 8 comments
Closed

Email fields and date customization #37

ghost opened this issue Oct 4, 2018 · 8 comments

Comments

@ghost
Copy link

ghost commented Oct 4, 2018

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
Copy link
Owner

nliautaud commented Oct 5, 2018

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.

$tpl_data->date = date('r');

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.

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


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

@nliautaud nliautaud changed the title configuration Email fields and date customization Oct 5, 2018
@ghost
Copy link
Author

ghost commented Oct 5, 2018

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
Copy link
Author

ghost commented Oct 29, 2018

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
Copy link
Owner

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 :

if (count($properties)) {
$html .= '(' . implode(', ', $properties) . ') ';
}

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
Copy link
Author

ghost commented Oct 29, 2018

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
Copy link
Owner

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
Copy link
Author

ghost commented Oct 30, 2018

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
Copy link
Owner

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) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant