Last change
on this file since 33169 was
33169,
checked in by rastapopoulos@…, 11 years ago
|
Deux balises d'alias #GENERER_SAISIES{tableau} et #CONFIGURER_SAISIE{type}.
Par défaut le formulaire pour configurer une saisie ne demande pas à configurer le "name" (ou "nom") car dans la majorité des cas c'est une valeur générée automatiquement dans les utilisations qu'on aura de cette balise. On peut le forcer avec le param "avec_nom" : #CONFIGURER_SAISIE{input, avec_nom=oui}
|
File size:
1.1 KB
|
Line | |
---|
1 | <?php |
---|
2 | |
---|
3 | // Sécurité |
---|
4 | if (!defined("_ECRIRE_INC_VERSION")) return; |
---|
5 | |
---|
6 | function construire_configuration_saisie($saisie, $avec_nom='non'){ |
---|
7 | include_spip('inc/yaml'); |
---|
8 | $config = array(); |
---|
9 | |
---|
10 | $configuration_base = yaml_decode_file(find_in_path('saisies/_base.yaml')); |
---|
11 | $configuration_base_plus = yaml_decode_file(find_in_path('saisies/_base_plus.yaml')); |
---|
12 | $configuration_saisie = yaml_decode_file(find_in_path('saisies/'.$saisie.'.yaml')); |
---|
13 | |
---|
14 | if (is_array($configuration_base) and is_array($configuration_base_plus) and is_array($configuration_saisie)){ |
---|
15 | // On ne garde le premier champ permettant de configurer le "name" seulement si on le demande explicitement |
---|
16 | if (!$avec_nom or ($avec_nom == 'non')) |
---|
17 | array_shift($configuration_base['options']); |
---|
18 | |
---|
19 | $config = array_merge( |
---|
20 | array( |
---|
21 | array( |
---|
22 | 'explication' => $configuration_saisie['explication'] |
---|
23 | ) |
---|
24 | ), |
---|
25 | $configuration_base['options'], |
---|
26 | $configuration_saisie['options'], |
---|
27 | array( |
---|
28 | array( |
---|
29 | 'groupe' => $configuration_base_plus['titre'], |
---|
30 | 'contenu' => $configuration_base_plus['options'] |
---|
31 | ) |
---|
32 | ) |
---|
33 | ); |
---|
34 | } |
---|
35 | |
---|
36 | return $config; |
---|
37 | } |
---|
38 | |
---|
39 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.