on passe via un fonction dist et non un global pour la description des saisies
This commit is contained in:
parent
09f7729156
commit
5999ca57f2
3 changed files with 58 additions and 47 deletions
|
@ -4,13 +4,16 @@ if (!defined('_ECRIRE_INC_VERSION')) {
|
|||
}
|
||||
|
||||
function formulaires_gamucontact_saisies_dist($id_auteur = 0, $redirect = '') {
|
||||
$saisies = $GLOBALS['gamucontact'];
|
||||
$f = charger_fonction('gamucontact', 'inc');
|
||||
$saisies = $f();
|
||||
|
||||
return $saisies;
|
||||
}
|
||||
|
||||
function formulaires_gamucontact_charger_dist($id_auteur = 0, $redirect = '') {
|
||||
$valeurs = [];
|
||||
$valeurs['_nospam_encrypt'] = true;
|
||||
|
||||
return $valeurs;
|
||||
}
|
||||
|
||||
|
@ -61,7 +64,8 @@ function formulaires_gamucontact_verifier_dist($id_auteur = 0, $redirect = '') {
|
|||
return $erreurs;
|
||||
}
|
||||
|
||||
$saisies = $GLOBALS['gamucontact'];
|
||||
$f = charger_fonction('gamucontact', 'inc');
|
||||
$saisies = $f();
|
||||
//champs obligatoire
|
||||
foreach ($saisies as $s) {
|
||||
if ($s['options']['obligatoire'] === 'oui') {
|
||||
|
@ -76,9 +80,10 @@ function formulaires_gamucontact_verifier_dist($id_auteur = 0, $redirect = '') {
|
|||
function formulaires_gamucontact_traiter_dist($id_auteur = 0, $redirect = '') {
|
||||
|
||||
include_spip('classes/facteur');
|
||||
$f = charger_fonction('gamucontact', 'inc');
|
||||
$saisies = $f();
|
||||
|
||||
$retour = [];
|
||||
$saisies = $GLOBALS['gamucontact'];
|
||||
$set = [];
|
||||
if (!empty($saisies)) {
|
||||
foreach ($saisies as $saisie) {
|
||||
|
|
|
@ -15,47 +15,3 @@ if (!defined('_ECRIRE_INC_VERSION')) {
|
|||
|
||||
$GLOBALS['formulaires_no_spam'][] = 'gamucontact';
|
||||
|
||||
|
||||
$GLOBALS['gamucontact'] = [
|
||||
[
|
||||
'saisie' => 'input',
|
||||
'options' => array(
|
||||
'nom' => 'nom',
|
||||
'label' => '<:gamucontact:votre_nom:>',
|
||||
'obligatoire' => 'oui',
|
||||
'class' => 'w100',
|
||||
//'fonction' => 'ma_super_fonction'
|
||||
)
|
||||
],
|
||||
[
|
||||
'saisie' => 'input',
|
||||
'options' => array(
|
||||
'nom' => 'email_contact',
|
||||
'label' => '<:gamucontact:votre_email:>',
|
||||
'class' => 'w100',
|
||||
'obligatoire' => 'oui',
|
||||
)
|
||||
],
|
||||
[
|
||||
'saisie' => 'input',
|
||||
'options' => array(
|
||||
'nom' => 'objet',
|
||||
'label' => '<:gamucontact:objet:>',
|
||||
'obligatoire' => 'oui',
|
||||
'class' => 'w100'
|
||||
//'fonction' => 'ma_super_fonction'
|
||||
)
|
||||
],
|
||||
[
|
||||
'saisie' => 'textarea',
|
||||
'options' => array(
|
||||
'nom' => 'texte',
|
||||
'label' => '<:gamucontact:message:>',
|
||||
'obligatoire' => 'oui',
|
||||
'class' => 'w100',
|
||||
'rows' => 4
|
||||
//'fonction' => 'ma_super_fonction'
|
||||
)
|
||||
],
|
||||
];
|
||||
|
||||
|
|
50
inc/gamucontact.php
Normal file
50
inc/gamucontact.php
Normal file
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
if (!defined('_ECRIRE_INC_VERSION')) {
|
||||
return;
|
||||
}
|
||||
|
||||
function inc_gamucontact_dist(){
|
||||
|
||||
return [
|
||||
[
|
||||
'saisie' => 'input',
|
||||
'options' => array(
|
||||
'nom' => 'nom',
|
||||
'label' => '<:gamucontact:votre_nom:>',
|
||||
'obligatoire' => 'oui',
|
||||
'class' => 'w100',
|
||||
//'fonction' => 'ma_super_fonction'
|
||||
)
|
||||
],
|
||||
[
|
||||
'saisie' => 'input',
|
||||
'options' => array(
|
||||
'nom' => 'email_contact',
|
||||
'label' => '<:gamucontact:votre_email:>',
|
||||
'class' => 'w100',
|
||||
'obligatoire' => 'oui',
|
||||
)
|
||||
],
|
||||
[
|
||||
'saisie' => 'input',
|
||||
'options' => array(
|
||||
'nom' => 'objet',
|
||||
'label' => '<:gamucontact:objet:>',
|
||||
'obligatoire' => 'oui',
|
||||
'class' => 'w100'
|
||||
//'fonction' => 'ma_super_fonction'
|
||||
)
|
||||
],
|
||||
[
|
||||
'saisie' => 'textarea',
|
||||
'options' => array(
|
||||
'nom' => 'texte',
|
||||
'label' => '<:gamucontact:message:>',
|
||||
'obligatoire' => 'oui',
|
||||
'class' => 'w100',
|
||||
'rows' => 4
|
||||
//'fonction' => 'ma_super_fonction'
|
||||
)
|
||||
],
|
||||
];
|
||||
}
|
Loading…
Add table
Reference in a new issue