Coding with SPIP 3.0
SPIP3.0 Technical Documentation

> > > > formulaire_charger

formulaire_charger

The formulaire_charger pipeline is used to modify the table of values that passed from the charger function for a CVT form. It is therefore called when displaying a form from the ecrire/balise/formulaire_.php file.

It is passed a parameter of the form name as well as the parameters passed to the form in the charger, verifier and traiter functions. It returns the table of values to be loaded.

  1. $valeurs = pipeline(
  2. 'formulaire_charger',
  3. 'args'=>array('form'=>$form,'args'=>$args),
  4. 'data'=>$valeurs)
  5. );

Download

Example

The "noSpam" plugin uses this pipeline to add a token indicating a validity period for the forms nominated in a global variable:

  1. $GLOBALS['formulaires_no_spam'][] = 'forum';
  2. //
  3. function nospam_formulaire_charger($flux){
  4. $form = $flux['args']['form'];
  5. if (in_array($form, $GLOBALS['formulaires_no_spam'])){
  6. include_spip("inc/nospam");
  7. $jeton = creer_jeton($form);
  8. $flux['data']['_hidden'] .= "<input type='hidden' name='_jeton' value='$jeton' />";
  9. }
  10. return $flux;
  11. }

Download

  • Author :
  • Published :
  • Updated : 31/05/10
  • Translations : English, français