feat: formulaire autonome, on peut passer dans l'array d'options soit obfusquer soit proteger
This commit is contained in:
parent
8e67ee4208
commit
1ef8ddec16
3 changed files with 16 additions and 15 deletions
|
@ -10,10 +10,13 @@
|
|||
#FORMULAIRE_BIGFORM{objet, id_objet, mode, args (array)}
|
||||
```
|
||||
- `mode` (facultatif) : le type d'image si besoin. Valeurs possibles : `auto | logoon | logooff`
|
||||
- `args` (facultatif) : un array d'options. Pour l'instant la seule supportée est `redirect` qui permet de renvoyer sur la page passée en argument.
|
||||
- `args` (facultatif) : un array d'options.
|
||||
- `redirect` qui permet de renvoyer sur la page passée en argument.
|
||||
- `obfusquer`
|
||||
- `proteger`
|
||||
Exemple pour revenir à la page principale "equipe" avec un bigform appelé dans une popin :
|
||||
```
|
||||
#FORMULAIRE_BIGFORM{article, #ID_ARTICLE, logoon, #ARRAY{redirect, #URL_PAGE{equipe}}}
|
||||
#FORMULAIRE_BIGFORM{article, #ID_ARTICLE, logoon, #ARRAY{redirect, #URL_PAGE{equipe}, obfusquer, oui}}
|
||||
```
|
||||
|
||||
## Usage 2 : en inclure dans un formulaire
|
||||
|
|
|
@ -3,17 +3,8 @@ if (!defined('_ECRIRE_INC_VERSION')) return;
|
|||
|
||||
function action_charger_document_dist($arg=null){
|
||||
|
||||
if (is_null($arg)) {
|
||||
// DEMI sécurité : s'il y a un hash, on teste la sécurité
|
||||
if (_request('hash')) {
|
||||
$securiser_action = charger_fonction('securiser_action', 'inc');
|
||||
$arg = $securiser_action();
|
||||
}
|
||||
// Sinon, on prend l'arg direct
|
||||
else {
|
||||
$arg = _request('arg');
|
||||
}
|
||||
}
|
||||
|
||||
include_spip('inc/autoriser');
|
||||
if (! autoriser("charger","document")) {
|
||||
|
|
|
@ -42,9 +42,16 @@ function formulaires_bigform_verifier_dist($objet, $id_objet, $mode = 'auto', $a
|
|||
|
||||
function formulaires_bigform_traiter_dist($objet = 'article', $id_objet = 0, $mode = 'auto', $args = []) {
|
||||
|
||||
$bigform = charger_fonction('bigform_traiter','inc');
|
||||
$options_secu = [];
|
||||
if (array_key_exists('proteger', $args)) {
|
||||
$options_secu['proteger'] = true;
|
||||
}
|
||||
if (array_key_exists('obfusquer', $args)) {
|
||||
$options_secu['obfusquer'] = true;
|
||||
}
|
||||
|
||||
$T = $bigform($id_objet,$objet,$mode);
|
||||
$bigform = charger_fonction('bigform_traiter','inc');
|
||||
$T = $bigform($id_objet,$objet,$mode, $options_secu);
|
||||
|
||||
pipeline('bigform_post_insertion', [
|
||||
'args' => [
|
||||
|
|
Loading…
Add table
Reference in a new issue