Coding with SPIP 2.1
SPIP 2.1 Technical Documentation

> > > > Passing arguments to the CVT functions

Passing arguments to the CVT functions

The charger(), verifier() and traiter() functions do not receive any parameters by default.

  1. function formulaires_x_charger_dist(){}
  2. function formulaires_x_verifier_dist(){}
  3. function formulaires_x_traiter_dist(){}

Download

For these functions to receive parameters, they need to be submitted as arguments explicitly when calling the form.

  1. #FORMULAIRE_X{argument, argument, …}

The PHP functions receive the parameters in the same order:

  1. function formulaires_x_charger_dist($arg1, $arg2,){}
  2. function formulaires_x_verifier_dist($arg1, $arg2,){}
  3. function formulaires_x_traiter_dist($arg1, $arg2,){}

Download

Note that there is a supplementary possibility to use the functions for dynamic tags, which make it possible to pass parameters automatically.

Example

The "Composition" plugin contains a form which requires a type and an identifier. It is called as follows:

  1. [(#FORMULAIRE_EDITER_COMPOSITION_OBJET{#ENV{type}, #ENV{id}})]

The processing functions therefore receive these two parameters:

  1. function formulaires_editer_composition_objet_charger($type, $id){}