formulaire_verifier

This pipeline is called from ecrire/public/aiguiller.php during the verification of data submitted from a CVT form. It is used to complete the array of errors returned by the verifier function for the form in question.

It is passed the same argument parameters as the formulaire_charger pipeline, those being the form name as well as the parameters passed in the the charger, verifier and traiter functions. It returns the array of errors as output.

$verifier = charger_fonction("verifier","formulaires/$form/",true);
$post["erreurs_$form"] = pipeline('formulaire_verifier', array(
	'args' => array(
		'form'=>$form,
		'args'=>$args),
	'data'=>$verifier 
		? call_user_func_array($verifier, $args) 
		: array()));

Example

The "OpenID" plugin uses this pipeline to verify that the provided OpenID URL is valid when an author edits his details, and if not, it provides an error message tagged for the field in question.

function openid_formulaire_verifier($flux){
	if ($flux['args']['form'] == 'editer_auteur'){
		if ($openid = _request('openid')){
			include_spip('inc/openid');
			$openid = nettoyer_openid($openid);
			if (!verifier_openid($openid))
				$flux['data']['openid'] = _T('openid:erreur_openid');
		}
	}
	// [...]
	return $flux;
}

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

Translations : English, français