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.

$valeurs = pipeline(
	'formulaire_charger',
	array(
		'args'=>array('form'=>$form,'args'=>$args),
		'data'=>$valeurs)
);

Example

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

$GLOBALS['formulaires_no_spam'][] = 'forum';
//
function nospam_formulaire_charger($flux){
	$form = $flux['args']['form'];
	if (in_array($form, $GLOBALS['formulaires_no_spam'])){
		include_spip("inc/nospam");
		$jeton = creer_jeton($form);
		$flux['data']['_hidden'] .= "<input type='hidden' name='_jeton' value='$jeton' />";
	}
	return $flux;
}

Author Mark Baber Published : Updated : 12/03/23

Translations : English, français